2012-10-12 33 views

回答

0

一些測試後,我發現用這款掛鉤

add_action('woocommerce_order_status_completed', 'check_quantity'); 
function check_quantity($order_id) { 

// order object (optional but handy) 
$order = new WC_Order($order_id); 

if (count($order->get_items()) > 0) { 
foreach($order->get_items() as $item) { 

// for all products if ($item['id'] > 0) { 
if ($item['id'] == 8) { 
$quantity=$item['qty']; 
add_qty($quantity); 

    } 
    } 
} 
} 
相關問題