Important bug breaking extensions
-
Hi!
I just wanted to let you (and others) know that the plugin currently breaks, and has been breaking, support with some other extensions, the most popular one being woocommerce-smart-coupons.
Around lines 2537 to 2543 in products.class.php function woocommerce_calculate_totals() : you can comment all the following lines to resolve the issue
if(!is_null($tr_product_id)){ $cart_item_data = (array) apply_filters( 'woocommerce_add_cart_item_data', array(), $cart->cart_contents[$key]['product_id'], $cart->cart_contents[$key]['variation_id']); $new_key = $woocommerce->cart->generate_cart_id( $cart->cart_contents[$key]['product_id'], $cart->cart_contents[$key]['variation_id'], $cart->cart_contents[$key]['variation'], $cart_item_data ); $cart->cart_contents = apply_filters('wcml_update_cart_contents_lang_switch',$cart->cart_contents,$key, $new_key,$current_language); $new_cart_data[$new_key] = $cart->cart_contents[$key]; $new_cart_data = apply_filters('wcml_cart_contents', $new_cart_data, $cart->cart_contents,$key, $new_key); } $cart->cart_contents = $new_cart_data;
The following lines seem to do absolutely nothing but generate a new cart ID and WooCommerce doesn’t recognize the cart anymore and empties it // empties the cart object associated to that ID. It might be a cross love/hate relationship between wpml, smart coupons and wpml multilingual, but I’ve pin pointed the bug to be that part since it seems to change absolutely nothing to generate a new id or not. Maybe it should be there?
Anyways, I hope this helps the many people I’ve seen having issues with both plugins installed. And @author: I would really like to hear what those few lines actually accomplish to know if removing them is the real best solution.
Regards,
Davidhttps://www.ads-software.com/plugins/woocommerce-multilingual/
- The topic ‘Important bug breaking extensions’ is closed to new replies.