Prima di tutto rendere funzione come questa:
function getWC_order_details($order_id) {
$order = new WC_Order($order_id);
var_dump($order);
}
Dopo di che, usalo con qualche woo_commerce
azione o filtro.
function use_after_cart_table(){
getWC_order_details(40);
}
add_action('woocommerce_after_cart_table', 'use_after_cart_table');
Così, dopo l'aggiunta di qualsiasi prodotto al carrello, si vedrà dopo la tabella della spesa che c'è una vasta gamma contenente tutti i dettagli.
NOTA: È possibile utilizzare qualsiasi altra azione o filtro e li si può trovare here.
Modificato:
function getWC_order_details($order_id) {
$order = new WC_Order($order_id);
//var_dump($order);
$order_shipping_total = $order->get_shipping();
$order_shipping_method = $order->get_shipping_methods();
var_dump($order_shipping_total);//Use it for debugging purpose or to see details in that array
var_dump($order_shipping_method);//Use it for debugging purpose or to see details in that array
$_order = $order->get_items(); //to get info about product
foreach($_order as $order_product_detail){
//var_dump($order_product_detail);
echo "<b>Product ID:</b> ".$order_product_detail['product_id']."<br>";
echo "<b>Product Name:</b> ".$order_product_detail['name']."<br><br>";
}
//var_dump($_order);
}
fonte
2015-03-04 05:58:29
E come avete usato questa funzione? Maggiori dettagli richiedono qui. –
' ' –
nickyb
Benvenuto in Stack Overflow. Ho cercato di migliorare il testo della tua domanda per rendere più chiaro agli altri quale sia il problema che stai incontrando. Se puoi collegarti a qualsiasi documentazione per 'get_order', ciò potrebbe rendere più facile per chi non ha familiarità con WooCommerce rispondere alla tua domanda. –