I m new in woo commerce, actually I want to know how add to cart function does work here .. I have to manage my custom data
global $woocommerce, $wp_session;
$custome_data = array(
"product_cat" => $wp_session['curr_object']['product_cat'],
"custom_height" => $wp_session['curr_object']['custom_height'],
"custom_width" => $wp_session['curr_object']['custom_width'],
"quantity" => $wp_session['curr_object']['qty'],
"qty" => $wp_session['curr_object']['qty'],
"product_id" => $product_id,
"unit_id" => $wp_session['curr_object']['unit_id'],
"dimension" => "custom_size");
$cart_item_kay = $woocommerce->cart->add_to_cart($product_id, $wp_session['curr_object']['qty'], 0, array(), $custome_data);
I m getting $cart_item_kay in my console.
but on another page:
I m write below code, its coming blank;
$items = $woocommerce->cart->get_cart();
echo "<pre>";
print_r($items);
echo "</pre>";
I attached file as well, please have a look !! parameters are correct, and there is no any syntax error.enter link description here
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire