Welcome to our Support Portal › Forums › WooCommerce Personalized Product Options Manager (PPOM) › Issue with bundled Products
- This topic has 68 replies, 5 voices, and was last updated 4 years, 7 months ago by
Jane Brian.
-
AuthorPosts
-
September 27, 2018 at 3:51 pm #9500
nmedia
KeymasterThanks for both gentlemen.
Now I need a little post/content say: How to use PPOM with WC Bundles.
and in return I will provide you any of my one plugin/addon FREE for future.
Thanks for this.
September 27, 2018 at 5:07 pm #9502Michel
ParticipantWe can help with this, but I’m still in trouble in this part.
What is happening now is that the additional information I put in the bundle, are not going to the cart.
As it is in the bundle: http://prntscr.com/kzfh8u (total value of 2,276)
After adding the bundle to the cart: http://prntscr.com/kzfi4f
He did not add 100% of the value over the bundle price (it was to add because the customer selected the “privatized service” inside the bundle), in fact, it increased by 100 the price of the product, as you can see in print ..Inside PPOM looks like this:
http://prntscr.com/kzfiwtSeptember 27, 2018 at 5:34 pm #9503Michel
ParticipantI was able to identify the problem:
http://prntscr.com/kzhneaWhat is happening is “%” is not working, instead of putting 100% of the value of the bundle, it is only adding 100 to the total value in the cart ..
The strange part is that the PPOM price table inside the product is showing correctly
September 27, 2018 at 5:38 pm #9504Michel
ParticipantAs you can see, prices appear correctly in the table:
http://prntscr.com/kzhonl
It is 100% multiplying the value of the bundle correctly, in the product table everything is correct.But when I add the product to the cart, it is not adding 100% of the value, you are only adding 100 to the value of the product, as you can see:
http://prntscr.com/kzhpddAs you can see, the price there is 669, and the price in the bundle is 569 .. So it only increased 100 in price, and did not add 100% of the price of the bundle
September 27, 2018 at 6:17 pm #9505Michel
ParticipantThis same problem is happening in simple (virtual) products, there is a price difference between what appears on the product page (inside the PPOM table) and the price that appears on the cart.
Price on product page: http://prntscr.com/kzi5ua
Price that appears when you add to cart: http://prntscr.com/kzi6tp
September 28, 2018 at 6:32 am #9506Lievelabels.nl
Participant@michel, that would be an issue with PPOM itself I guess.
September 28, 2018 at 6:53 am #9508nmedia
KeymasterHi,
Yes we identified this bug and fixing this. I will be applied to next release today. Please provide me good article/how to content about: How to use PPOM with WC Bundle Products.
Best regards,
NajeebSeptember 28, 2018 at 6:58 am #9509Lievelabels.nl
ParticipantLike a public document?
September 28, 2018 at 7:09 am #9510nmedia
KeymasterYes Please, and issue fixed related to % price I am pushing these changes in main plugin under same version 14.1
September 28, 2018 at 7:16 am #9511nmedia
Keymaster@Lievelabels.nl also let me know what changes should I add in PPOM to make it compatible.
September 28, 2018 at 7:47 am #9514Lievelabels.nl
Participant@nmedia, I’m currently investigating the filters that need to be disabled on bundled items… but it seems, I’m running into problems…….
As soon as I know more I will return.. Just not sure it will be this week.September 28, 2018 at 8:27 am #9516Lievelabels.nl
Participant@nmedia, I think I have the solution, but please double check, test and see if I forgot any step in the process.
explanation:
Everytime we are working with items and PPOM, we need to check if the item is a bundled item.
We do this by checking if the class exists and check the item.
if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $product_id )) {
The actual changes:
file: woocommerce-product-addon\inc\woocommerce.phpfunction ppom_woocommerce_add_cart_item_data($cart, $product_id) { if( ! isset($_POST['ppom']) ) return $cart; if( ! $selected_meta_id = ppom_has_product_meta( $product_id ) ) { return $cart; } // ADDED WC BUNDLES COMPATIBILITY if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $product_id )) { return $cart; } $ppom_settings = PPOM() -> get_product_meta ( $selected_meta_id ); if( empty($ppom_settings) ) return $cart; // PPOM also saving cropped images under this filter. $ppom_posted_fields = apply_filters('ppom_add_cart_item_data', $_POST['ppom'], $_POST); $cart['ppom'] = $ppom_posted_fields; // ppom_pa($_POST); exit; return $cart; }
function ppom_woocommerce_add_item_meta($item_meta, $cart_item) { if( ! isset($cart_item['ppom']['fields']) ) return $item_meta; // ADDED WC BUNDLES COMPATIBILITY if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $cart_item )) { return $item_meta; } $ppom_meta = ppom_make_meta_data( $cart_item ); // var_dump($ppom_meta); foreach( $ppom_meta as $key => $meta ) { $hidden = isset($meta['hidden']) ? $meta['hidden'] : false; $display = isset($meta['display']) ? $meta['display'] : $meta['value']; if( $key == 'ppom_has_quantities' ) $hidden = true; // if( $key == 'ppom_has_files' ) $hidden = true; if( isset( $meta['name']) ) { $meta_val = $meta['value']; if( apply_filters('ppom_show_option_price_cart', false) && isset($meta['price']) ) { $meta_val .=' ('.wc_price($meta['price']).')'; } $meta_key = stripslashes($meta['name']); // WPML $meta_key = ppom_wpml_translate($meta_key, 'PPOM'); $item_meta[] = array('name' => wp_strip_all_tags($meta_key), 'value' => $meta_val, 'hidden' => $hidden, 'display'=>$display); } else { $item_meta[] = array('name' => ($key), 'value' => $meta, 'hidden' => $hidden, 'display'=>$display); } } return $item_meta; }
function ppom_woocommerce_order_item_meta($item_id, $cart_item, $order_id) { if ( ! isset ( $cart_item ['ppom']['fields'] )) { return; } // ADDED WC BUNDLES COMPATIBILITY if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $cart_item )) { return; } $ppom_meta = ppom_make_meta_data( $cart_item, 'order' ); // var_dump($ppom_meta); exit; foreach( $ppom_meta as $key => $meta ) { ppom_add_order_item_meta($item_id, $key, $meta['value']); } }
I think by adding the check to these 3 functions we have solved the problem.
September 28, 2018 at 11:21 am #9518Lievelabels.nl
Participant@nmedia? Any question?
September 28, 2018 at 11:59 am #9519Michel
ParticipantFor me, the problem with the Woocommerce Product Bundle (WCPB) has been solved in a very simple way.
Let’s say I have 3 simple virtual products, and each of these products needs to have an additional field in case the customer wants to add a gift package, a simple checkbox that increases the value of the product by 30%.
And I also want to sell a package with these 3 products together at a discount, but this package also needs the additional field for a gift package, also increasing 30% of the value of the product.
Note that the additional field is the same in both cases. Both the 3 products and the bundle will have the option of an additional 30%, but you see, in the bundle, that additional 30% can only be applied once, at the total price of the bundle, and not within each sub product.
For PPOM to work correctly with WCPB, it is necessary to create 2 different PPOMs (even though they both have the same field), one for the separate products and one for the bundle itself. It is important that both the PPOM list and the checkbox inside them have different data name. That is, the PPOM of the products will have a different ID than the PPOM of the bundle.
So I have the following:
PPOM 1 (Product) = [checkbox data_name = “checkbox_product”]
PPOM 2 (Package) = [checkbox data_name = “checkbox_package”]Separate products:
PRODUCT 1 = PPOM 1
PRODUCT 2 = PPOM 1
PRODUCT 3 = PPOM 1The bundle would look like this:
BUNDLE A = PPOM 2
– PRODUCT 1 (without PPOM)
– PRODUCT 2 (without PPOM)
– PRODUCT 3 (without PPOM)So let’s say if BUNDLE were priced at 100, and the user wanted to add the package to the gift, PPOM would increase 30% of 100 and would not affect the sub-products.
If you do not do this and create a PPOM for both, when the user adds the bundle presents in BUNDLE, PPOM will also add 30% in the sub products as they would both have the same ID (data_name).
So it’s important to create different data_names for different product types, have a warning (http://prntscr.com/kzs4oc) inside the plugin, but it would be interesting to leave it highlighted and also add that question to the BUNDLES.
I hope I have helped, I will be waiting for the patch today, which fixes this bug with the prices of the cart, which I posted here previously.
September 28, 2018 at 2:23 pm #9523Lievelabels.nl
ParticipantA short howto for Product Bundles:
WooCommerce Personalized Product Options Manager is compatible with Woocommerce Product Bundles.
However, keep in mind that bundled items, which can also have their own meta data, their metadata will not show up in the bundle.
For bundled items, PPOM Meta Data will completely be ignored, only the Parent container of the bundle can have Meta data.-
This reply was modified 5 years, 2 months ago by
Lievelabels.nl.
-
This reply was modified 5 years, 2 months ago by
-
AuthorPosts
- The topic ‘Issue with bundled Products’ is closed to new replies.