I am building a custom solution to save the state and content of a Cart and then re-adding a bundle product back to the cart.Â
The saving part works, but re-adding the bundled product, adds the full bundle to the cart and does not take account the $cart_item['woosb_ids'] and quantity it has.
For example, a bundle contains 3 items. From this bundle I only set the quantity of one child item on 1 and the other two to 0 quantity.
So my question is: "Which WPC PHP method or multiple methods do I needs to call to add a "WC_Product_Woosb" product to the cart which has the correct quantity based on it's "woosb_ids'?
Thank you for reaching back to us đŸ˜„. I have assigned our developer Frankie Uri to help answer your question soon. Please stay in touch for his response. Kindly note that support might be a bit slower due to the weekends.
Adding a bundle to the the cart is quite complex and base on the bundle's settings about price & discount. You can see this function here https://prnt.sc/qbe2zb
$woocommerce->cart->add_to_cart( $item[‘product_id’], $item[‘quantity’], $item[‘variation_id’], $item[‘variation’], $item ) in Bundle Product plug in or even in woocommerce plug in. Can you please tell me in which file I will find the function.
That code isn't a part of the WPClever Bundle plugin. It lives somewhere in your theme, or another plugin. In my case, it was located in https://wordpress.org/plugins/woo-save-and-share-cart/. It was in an older version of the other plugin.
So the WP Clever bundle works properly. If this anwser doesn't solve you problem, could you please open a separate ticket with some more explaination, steps to repoduce and other information about your WordPress installation and plugins.
Kind regards,
Jaime (not a employe of WPClever, just trying to help ^^ _
Dear WPClever,
I am building a custom solution to save the state and content of a Cart and then re-adding a bundle product back to the cart.Â
The saving part works, but re-adding the bundled product, adds the full bundle to the cart and does not take account the $cart_item['woosb_ids'] and quantity it has.
For example, a bundle contains 3 items. From this bundle I only set the quantity of one child item on 1 and the other two to 0 quantity.
So my question is: "Which WPC PHP method or multiple methods do I needs to call to add a "WC_Product_Woosb" product to the cart which has the correct quantity based on it's "woosb_ids'?
Kinds regards,
Jaime Martinez
Hi,
Thank you for reaching back to us đŸ˜„. I have assigned our developer Frankie Uri to help answer your question soon. Please stay in touch for his response. Kindly note that support might be a bit slower due to the weekends.
All the best.
Janilyn T. - WPClever Support Agent
Hi Jaime,
Adding a bundle to the the cart is quite complex and base on the bundle's settings about price & discount. You can see this function here https://prnt.sc/qbe2zb
Best regards,
Dustin
Hi Jaime,
I got the same pb as you regarding setting a different quantity of one child item of the bundle and adding to the cart.
Did you solve the issue? how?
Sincerely
Damien
You should pass the whole $item as last argument to the add_to_cart method
$woocommerce->cart->add_to_cart( $item[‘product_id’], $item[‘quantity’], $item[‘variation_id’], $item[‘variation’], $item );
Example: See https://wordpress.org/support/topic/not-working-with-bundled-products/#post-12673615Thank you Jaime for your support.
Could not find the function
$woocommerce->cart->add_to_cart( $item[‘product_id’], $item[‘quantity’], $item[‘variation_id’], $item[‘variation’], $item ) in Bundle Product plug in or even in woocommerce plug in. Can you please tell me in which file I will find the function.
Thank you
Damien
Hi Daniel,
That code isn't a part of the WPClever Bundle plugin. It lives somewhere in your theme, or another plugin. In my case, it was located in https://wordpress.org/plugins/woo-save-and-share-cart/. It was in an older version of the other plugin.
So the WP Clever bundle works properly. If this anwser doesn't solve you problem, could you please open a separate ticket with some more explaination, steps to repoduce and other information about your WordPress installation and plugins.
Kind regards,
Jaime (not a employe of WPClever, just trying to help ^^ _