• Resolved david_treblig

    (@david_treblig)


    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,
    David

    https://www.ads-software.com/plugins/woocommerce-multilingual/

Viewing 2 replies - 1 through 2 (of 2 total)
  • HI david_treblig,

    Thanks for reporting the issue. We had no mentions about our compatibility with this plugin. I guess these lines are in fact important, as we recalculate cart ID’s often, as they need to change for each language (as the product id’s change as well). The issue is probably related to the filters (maybe smart coupons is applying some other filters with a different priority). Anyway, for the moment, you can keep your modifications if you’re experiencing no problems, but we’ll add this plugin to our compatibility list and contact the author to make them compatible. ??

    Thanks for your report!
    Bernat

    Thread Starter david_treblig

    (@david_treblig)

    No problem!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Important bug breaking extensions’ is closed to new replies.