• Resolved kingbob999

    (@kingbob999)


    Hello,
    I created a page in Gutenberg. It contains product filters made with a free version of YITH WooCommerce Ajax Product Filter embedded as a short code block and Product Collection (Beta) block. They filter perfectly but the ajax “Add to cart” button stops working afterwards. It can be reproduced with any standard theme.

    Will appreciate any help.

    Best regards,

    Roman K

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Vanesa

    (@vanesarodriguez)

    Hi there,
    I hope you are doing well ??

    Could you, please, share a link of a page where this is happening with us? so we can check it.

    Thanks for your cooperation.

    Thread Starter kingbob999

    (@kingbob999)

    Hi Vanesa,
    Thank you for the reply!
    This is the link https://www.janmarini.site/shop/ . You can use any filter and then try to click “Add to cart”.
    This site is still under construction.
    Best regards,
    Roman K

    Plugin Support Pablo Pérez

    (@pperez001)

    Hi Roman,

    Currently our plugin has this problem with this block that is in beta and the developer is working on a posible solution this problem for a future version. Meanwhile, please add the following code in your functions.php of your theme, to fix this problem :

    if( ! function_exists('yith_wcan_fix_product_collection_add_to_cart') && function_exists( 'YITH_WCAN' ) ){
    
    	add_action( 'init', "yith_wcan_fix_product_collection_add_to_cart");
    
    	function yith_wcan_fix_product_collection_add_to_cart() { 
    
    		$js = "jQuery( ( $ ) => {
    			$( document ).on( 'yith-wcan-ajax-filtered', () => {
    				window.document.dispatchEvent( new Event( 'DOMContentLoaded', {
    					bubbles: true,
    					cancelable: true
    				} ) );
    			} );
    		} );";
    		wp_add_inline_script( 'yith-wcan-shortcodes', $js );
    
    		
    	}
    }

    Have a great day.

    Thread Starter kingbob999

    (@kingbob999)

    Hi Pablo,
    Thank you very much for your quick response!
    It works perfectly.
    Best regards,
    Roman K

    Plugin Support Pablo Pérez

    (@pperez001)

    You are welcome Roman! I’m glad this code could help you.

    If you enjoy our plugin and support, please feel free to leave a review, it helps more that it seems.

    I will close this topic.

    Have a great day.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.