خرید بک لینک

Vote count: 0

I am using the woocommerce_new_order_item hook in my functions.php file.

The code I have is:

add_action( 'woocommerce_new_order_item', 'wc_order_item_added',  1, 1  );
function wc_order_item_added($item_id, $item, $order_id) {
    global $mysqli;

    //$order = new WC_Order( $item_id );

    $sql = $mysqli->query("INSERT into a_test (one) values ('".$item_id."');");
}

Which I found from: http://hookr.io/actions/woocommerce_new_order_item/

But the $order_id variable is not being retued. The only variable that is working is, $item_id

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 31 خرداد 1395 ساعت: 2:17

صفحه بندی