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 7, 2018 at 9:03 pm #9341
Lievelabels.nl
ParticipantIt seems when bundled products are added, for each item in the bundle, the ppom meta is repeated.
Try this product and put it in the cart:
https://www.lievelabels.nl/product/kraampakket-zelf-samenstellenIt’s to big to create a screenshot. Please try and make it compatible with Product Bundles plugin, so the meta is shown only once.
September 24, 2018 at 1:39 pm #9420Lievelabels.nl
ParticipantCan you please give me an update on this issue?
It would be best to hide PPOM data for bundled items, which we can check with:
if ( wc_pb_is_bundled_cart_item( $product )) {}
September 24, 2018 at 2:46 pm #9421Lievelabels.nl
Participantfunction ppom_woocommerce_add_item_meta($item_meta, $cart_item) { if( ! isset($cart_item['ppom']['fields']) ) return $item_meta; if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $cart_item )) { return $item_meta; } ........
-
This reply was modified 5 years, 2 months ago by
Lievelabels.nl.
September 26, 2018 at 12:56 pm #9432Michel
ParticipantI’m having the same problem, have you managed to come up with a solution? The plugin developer could answer this topic please.
September 26, 2018 at 1:03 pm #9433Lievelabels.nl
Participantyes… I have found the solution. I had to change a function in:
woocommerce-product-addon\inc\woocommerce.phpfind function on line 473:
function ppom_woocommerce_add_item_meta($item_meta, $cart_item) {
add after line 475:
if( ! isset($cart_item['ppom']['fields']) ) return $item_meta;
added content:
if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $cart_item )) { return $item_meta; }
so final result is:
function ppom_woocommerce_add_item_meta($item_meta, $cart_item) { if( ! isset($cart_item['ppom']['fields']) ) return $item_meta; 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; }
Hopefully N-Media will add it permanently!
Good luck.-
This reply was modified 5 years, 2 months ago by
Lievelabels.nl.
September 26, 2018 at 1:10 pm #9435Michel
ParticipantThanks a lot for the help, I just have a question, this would be a direct modification to the core of the plugin, so if I updated the plugin I would lose this modification, correct?
Any option on that?
September 26, 2018 at 1:16 pm #9436Lievelabels.nl
ParticipantThat is correct! Changes will be gone after an update! They need to add it as permanent solution!
September 26, 2018 at 1:30 pm #9437Lievelabels.nl
ParticipantWhat we could do, is maybe remove the filter on a certain condition
remove_filter ( 'woocommerce_get_item_data', 'ppom_woocommerce_add_item_meta', 10, 2 );
I need to think about itaddfilter_filter ( 'woocommerce_get_item_data', 'wc_pb_is_bundled_cart_item', 11, 2 ); function ppom_woocommerce_remove_item_meta($item_meta, $cart_item) { if ( class_exists('WC_Bundles') && wc_pb_is_bundled_cart_item( $cart_item )) { remove_filter ( 'woocommerce_get_item_data', 'ppom_woocommerce_add_item_meta', 10, 2 ); } }
We can test this maybe in functions.php
-
This reply was modified 5 years, 2 months ago by
Lievelabels.nl.
September 26, 2018 at 1:38 pm #9439Michel
ParticipantUnfortunately the first option did not work the way I needed it ..
What is happening is that when the user adds an option within the product bundle, he adds a price to each of the subitems inside the cart and checkout
http://prntscr.com/kyyvyq
(print with the modification in the core, first option)This price was not supposed to exist in the sub products
I’m going back to the initial and testing this filter that you sent
September 26, 2018 at 1:43 pm #9440Lievelabels.nl
ParticipantAre you using the Same Bundle plugin as I am?
I’m using:September 26, 2018 at 1:44 pm #9441Michel
ParticipantYes, same plugin. Product Bundle from Woocommerce
September 26, 2018 at 1:57 pm #9442Lievelabels.nl
ParticipantThen I don’t understand your issue at the moment….
September 26, 2018 at 2:12 pm #9443Michel
ParticipantI modified the core as you had passed, then it had not worked, I returned the initial configuration and went up again on my server, but in live it did not return to normal …
Now besides being appearing price within each subitem, is adding to the total value …
This is the product page: http://prntscr.com/kyzh7n
This is the total price that should appear in the cart and checkout, but because I add the “Private Service” that is a Product Addon and has a price of 100% of the bundle value, it is adding 100% of the value for each subitem my bundle, modifying the total price that appears in the cart and checkout.
-
This reply was modified 5 years, 2 months ago by
Michel.
September 26, 2018 at 2:33 pm #9445Lievelabels.nl
ParticipantAre you sure its the modification of the core?
September 26, 2018 at 2:39 pm #9446Michel
ParticipantYes, before I did the core modification, there was a random price in the subitems but it did not interfere with the final price.
No problem happens when I do not select the Product Addon.
That’s how it goes when I do not select the Product Addon (which is a checkbox that adds 100% of the product value), and all it should do when selected is to increase the total value of the bundle by 100%
-
This reply was modified 5 years, 2 months ago by
-
AuthorPosts
- The topic ‘Issue with bundled Products’ is closed to new replies.