• Hi, I report my experience with the plugin.

    I’m using WordPress 6.4.3?with Woocommerce 8.7.0, with a self-developer theme, plus other plugins.

    I noticed that YITH WooCommerce Product Add-Ons works fine, except in cart page. In my website, users get a javascript error everytime they update cart (eg after changing items quantity or adding coupon code).

    ‘Uncaught TypeError: t.addClass(…).block is not a function’ on cart.min.js

    I fixed it changing wp-content/plugins/yith-woocommerce-product-add-ons/includes/class-yith-wapo-front.php:148

    wp_register_script('yith_wapo_front',
    	YITH_WAPO_URL . 'assets/js/front' . $suffix . '.js',
    	array('jquery', 'jquery-ui-datepicker', 'jquery-ui-progressbar', 'wc-add-to-cart-variation', 'jquery-blockui'),
    	defined('YITH_WAPO_SCRIPT_VERSION') ? YITH_WAPO_SCRIPT_VERSION : YITH_WAPO_VERSION,
    	array(
    		'strategy' => 'defer'
    	)
    );
    


    Can you tell me how to fix without changing plugin core code?

    Thank you very much!


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well :D.

    I would like to take a look on your site in order to reproduce the problem and make some test.

    Probably the problem could be a conflict with jQuery. Probably you are loading different jQuery versions on your page.

    Please, could you send me the url of your site and a product with addons?

    I’m looking forward your response.

    Have a good day,

    Thread Starter ziabetta84

    (@ziabetta84)

    Hi Carlos, thank you so much for you kind reply!

    This is the only product configured with your plugin: https://www.settantanovestudio.it/prodotto/ciondolo-poodle/

    The bug happened in cart page https://www.settantanovestudio.it/carrello/

    But now, I fixed it as I explained in first post.

    If you want to make some test, here’s the stage version of the same website without my fix:
    https://dev2.quartopianocomunicazione.it:8888/site_79studio_2022/
    (You may need to bypass browser security warnings, it’s a self-hosted website with self-generated SSL certificate on MAMP)

    Thanks again,

    Roberta

    Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well :D.

    If you want to force a defer on a specific script, maybe you can use the following code in the functions.php of your active theme:

    if( !function_exists('yith_wapo_add_defer_frontend_js') ) {
        function yith_wapo_add_defer_frontend_js($tag, $handle)
        {
            if ('yith_wapo_front' !== $handle) {
                return $tag;
            }
            return str_replace(' src=', ' defer src=', $tag);
        }
    
        add_filter('script_loader_tag', 'yith_wapo_add_defer_frontend_js', 10, 2);
    }

    Please, try it and let me know.

    Have a good day,

    Carlos R.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bugfix for cart’ is closed to new replies.