• ResolvedPlugin Support Thu P. a11n

    (@thup90)


    Hello,

    On my front page, there are the latest products from a category being shown. I have added Woocommerce Ajax add to cart plugin (by Oraksoft) so it’s working on my single product page. However, I want to ajaxify the products shown on front page as well. I’m wondering if there is a way to do this? My products are simple products.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    It depends on how your front page is adding the products to it. Is it coming from a shortcode, or it the page automatically generated?

    Do you have the “ajax add to cart” setting enabled at WooCommerce > Settings > Products > Display?

    Plugin Support Thu P. a11n

    (@thup90)

    @caleb Burks The products are being displayed using the Product Category in Visual Composer, but I could also code a loop if it helps accomplishing the ajax effect.

    Yes, I do have the setting enabled. Ajax works fine on the Archive page, but not on the front page. My guess is the buttons don’t have the same classes so ajax scripts can’t find the data from the button on the front page, but I’m not sure how to apply it to content-product.php , using maybe this gist https://gist.github.com/webaware/6260468 ?

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Hmm, ajax add to cart is working for me on a custom page with the recent products shortcode: https://cld.wthms.co/A3Tp/3FFVMnEk

    Have you tried using one of the WooCommerce shortcodes? I’d think that is what visual composer does though…strange.

    Plugin Support Thu P. a11n

    (@thup90)

    I have tried switching to the recent products shortcode, but it also doesn’t work.

    I think I know why now, it’s definitely because of the ajax function in Woocommerce settings, when I enable the setting alone, nothing happens even on archive pages. So I have been using the Gist https://gist.github.com/webaware/6260468 to make ajax on the archive page work. The setting doesn’t work on archive page, so I guess it makes sense that it doesn’t work on a custom page. Do you have a clue as to why the built-in ajax doesn’t work?

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Not sure.

    Try temporarily switching back to the WordPress Twenty Sixteen Theme, or Storefront, and disable all plugins except for WooCommerce. If that resolves the issue, then slowly re-enable features until you find the one that’s causing the conflict.

    Plugin Support Thu P. a11n

    (@thup90)

    Thanks! Finally figured it out! I did like you said, switching it back to Twenty sixteen and it worked, so the problem was because of the theme I’m using.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Ajax Add to cart button for front page’ is closed to new replies.