How to show only the bundled product in the cart when using Woocommerce’s composite product

When using Woo-commerce’s composite products to create bundle products, we fell into a little problem. The bundle products, where individually being shown in the cart including the final bundled product. There was a couple of issues with this; First the bundle product and its children being listed in the cart could make the bundle product very confusing for the customer, Second the children products could be removed from the cart cause the cart to error out.

 

 

To solve this issue go to the main Woo-commerce composite products php file woocommerce-composite-products.phpThen go to this function¬† function woo_bto_add_items_to_cartIt’s listed out fully with parameters here function woo_bto_add_items_to_cart( $item_cart_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data )

Scroll down to line 1025, this line of code should be there $woocommerce->cart->add_to_cart( $composited_product_id, $quantity, $variation_id, $variations, $composited_item_cart_data );

comment that line of code out.

Now the cart will only show the main parent bundle product, yet the order will contain the same bundle product data.

0 Comments

Leave a Reply