• We are using YITH ajax product filters and we have a problem with adding products to the cart. When we enter the products archive page and click add to cart – it works. But when we select any category to see only the products from that category – the add to cart button does not work correctly, when you click on it it just redirects you back to the products archive (without selected category) and only then adds the product to cart. If you reload the page after you select the category – the button starts working normally again. We have a few shops where we are using this plugin and this bug appears in all of them. We are also using Elementor Pro.

    • This topic was modified 10 months, 1 week ago by aidasj7.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Iván Sosa

    (@ivansosa)

    Hi there,

    I hope you are doing well! ??

    I can’t replicate the issue.
    I can see that the out of stock products redirect to the product page, but the other products can be added to the cart without problem.

    You can see both examples in this link: https://beautycity.lt/produkto-kategorija/plauku-prieziurai/kondicionieriai-plaukams/?yith_wcan=1&product_tag=eleven-australia&product_cat=kondicionieriai-plaukams

    Could you check it, please?

    Thread Starter aidasj7

    (@aidasj7)

    When you press add to cart after YITH AJAX load categories add to cart request is not AJAX and page is reloading and redirecting. In console you can see error. I have the same bug with your plugin in 10 other websites. But if you don’t press YITH categories, add to cart is working with AJAX. To see the bug you need to load this page for example: https://beautycity.lt/produkto-kategorija/plauku-prieziurai/kondicionieriai-plaukams/?yith_wcan=1&product_tag=eleven-australia&product_cat=kondicionieriai-plaukams and press any other category on the left, and the add to cart AJAX will stop working. AJAX add to cart starts working only if you reload the page. So if you open this link and try add to cart it will be working, but if you choose another category in the left add to cart AJAX will be not working since you clicked, but if you press reload page it starts working. And also your other plugin stops working – YITH wish list – because of product filter errors.

    In other website i fixed this bug with this code:

    if( ! function_exists( ‘yith_wcan_content_selector’ ) ){ function yith_wcan_content_selector( $selector ){ $selector = ‘.elementor-location-archive.product’; return $selector; } add_filter( ‘yith_wcan_content_selector’, ‘yith_wcan_content_selector’ ); }

    But this code does not help on this website, I tried to add other css classes and change them in the code, but nothing changes.

    Console errors show only if you press on YITH product filter category and you are connected with admin, but if you reload the page console doesn’t show error – you need to press another category and it shows again:

    frontend.min.js?ver=3.18.3:2 Uncaught TypeError: Cannot read properties of undefined (reading ‘handlers’)
    at 3515 (frontend.min.js?ver=3.18.3:2:4476)
    at webpack_require (:2:150)
    at 4774 (frontend.min.js?ver=3.18.3:2:4130)
    at webpack_require (:2:150)
    at 2 (frontend.min.js?ver=3.18.3:2:137)
    at webpack_require (:2:150)
    at frontend.min.js?ver=3.18.3:2:25088
    at webpackJsonpCallback (:2:5466)
    at Array.forEach ()
    at :2:5677

    • This reply was modified 10 months ago by aidasj7.
    • This reply was modified 10 months ago by aidasj7.
    • This reply was modified 10 months ago by aidasj7.
    Plugin Support Iván Sosa

    (@ivansosa)

    Hi there,

    The cause of this issue is due to the theme doesn’t follow the standard WooCommerce structure, where the content of the page will have the id #content, so the filtering content for our plugin extends to the whole body of the page on your site. Please, try to add this custom function in the functions.php of your theme:

    if( ! function_exists( 'yith_wcan_content_selector' ) ){
    
     function yith_wcan_content_selector( $selector ){
    
     $selector = '.ob-is-breaking-bad .elementor-container';
    
     return $selector;
    
        }     
    
     add_filter( 'yith_wcan_content_selector', 'yith_wcan_content_selector' ); 
    
    }

    Let us know if that did the trick.

    Thread Starter aidasj7

    (@aidasj7)

    Hi, it’s not working

    Plugin Support Iván Sosa

    (@ivansosa)

    Hi there,

    maybe you need to find a trigger to allow the ajax add to cart button work as expected again.

    We kindly suggest to contact the team that implement the ajax add to cart to know if there is any possibility doing this.

    We hope it helps you.

    Thread Starter aidasj7

    (@aidasj7)

    This bug is on your side and only occurs because of your plugin and there are clear errors in the console. And you suggest contacting the people who developed add to cart ajax, even though it works fine without your plugin? We don’t need to find a way to trigger add to cart ajax, you have to fix your plugin so that there are no errors in the console and then everything will work perfectly. And I see that there are many threads with these console errors from other users and you suggest to disable cache things, although even without them nothing works. Please resolve this bug. Or do we only get a working plugin after paying for it?

    Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well :D.

    I checked and the problem is that after add to cart in ajax, it lost the trigger for generate the add to cart in ajax.

    I tried to check the source code but seems the code is minified and it cannot allow me to do a debug from the browser. Probably it could be a conflict with Elementor Pro but I cannot download it from the repo in order to check it direclty on my local installation.

    I suggest you to try disabling elementor and see if you get the same problem.

    If not, try to contact elementor developers as you have a pro version that we cannot support.

    I hope it helps you.

    Have a good day.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Add to cart ajax not working’ is closed to new replies.