Product bundles being split into items
-
Hi Fahad
I’m really hoping you might be able to help with this one. It feels like the last piece in a big puzzle!
We use a plugin called Woocommerce Product Bundles
https://woocommerce.com/products/product-bundles/
The plugin allows shop managers to create a ‘bundle’ out of existing products. A bit like a product group, but with the ability to set a ‘bundle’ price and other extra features.Unfortunately it doesn’t work too well with your order splitter plugin.
When it comes to splitting an order, your plugin parses all line items within an order. In the case of a product bundle it parses both the parent bundle as well as the individual items within the bundle and treats them separately. Both the bundle and the items within a bundle get listed separately as line items within the new order ID, along with a price for each. This really confuses the customer as it looks like they’re been charged way too much and have too many items within their order.
For example, a customer orders an item called ‘Big Bundle’ which contains individual items (‘product A’ and ‘product B’), but at a discounted price.
– Without the order splitter, the customer would never see the items within the bundle. Those child items wouldn’t be visible at the checkout, thank you page or in their customer emails. They’d only see the parent bundle item called ‘Big Bundle’ and a single price for that.
– With your order splitter plugin active, the customer sees the items within the bundle AND the parent bundle, as well the additional cost of the bundled items added to the price of the bundle parent. On the order thank-you page and in emails they see ‘BIG Bundle’ and also ‘Product A’ and ‘Product B’ listed as separate items all with individual prices.
It’s possible to check if the bundle plugin is active with:
if ( class_exists( 'WC_Bundles' ) ) { ... }
There are various ways to identify a bundled line item.
Perhaps the easiest and most reliable way is to call:
wc_pb_is_bundled_order_item( $order_item )
which returns true if the line item belongs within a bundle.
I also have examples of what a parent product bundle and a child product item object looks like:
https://gist.github.com/tictok/3887a5035476da554d58bfa4a3df3d2f
As you’ll see there are various meta keys that denote whether the item is a bundled product or not.I need to find a way to not show the individual bundled items and somehow keep the overall product bundle intact when the order item is processed by your order splitter.
I really hope that makes sense and wonder if you have any ideas?
I’m a bit stumped with this.
With hope and many thanks,
Stef
- The topic ‘Product bundles being split into items’ is closed to new replies.