Ajax Add to Cart issues - by swaldner - on WordPress WooCommerce support

This topic has 4 replies, 2 voices, and was last updated 7 years, 8 months ago ago by Eva Kemp

  • Avatar: swaldner
    swaldner
    Participant
    August 27, 2016 at 22:12

    ISSUE 1
    Adding to cart with ajax does not work for bundles products. I have stuffed the classes “etheme_add_to_cart_button”, “progress-button”, and “product_type_downloadable” into the button tag but sheesh, why is ajax restricted to only certain product types in your theme? A previous theme I was using worked just fine with ajax and all product types.

    ISSUE 2
    Is there a built-in way to override (get rid of) the ajax progress bar but still retain the classes that are added to and removed from the button.

    3 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    August 29, 2016 at 09:11

    Hello,

    1. Please show a product page where ajax Add to Cart isn’t working.

    2. Sorry, your query is a bit unclear. What do you want to achieve regarding Add to Cart button?

    Regards,
    Eva Kemp.

    Avatar: swaldner
    swaldner
    Participant
    August 29, 2016 at 16:56

    Sorry, I am developing on a private development server so I cannot give you remote access.

    The problem is that I’m using a Woocommerce plugin “Woocommerce Bundled Products”. I’m generating an add-to-cart button with the shortcode [add_to_cart id='nnn'] and your code does not perform an ajax add to cart when the button is clicked. I’ve looked into your javascript and found that the reason is twofold:

    1) The click event on the add-to-cart button is never fired because the class “etheme_add_to_cart_button” is not added by your code to the button.

    2) If the “etheme_add_to_cart_button” is added and the click event is fired, your code checks for specific product types in the add-to-cart click event on line 1348 of etheme.js

    if ($thisbutton.is(‘.single_add_to_cart_button, .etheme-simple-product, .product_type_downloadable, .product_type_virtual’) . . .

    May I suggest leaving out the checking of a product type altogether. If it is an add-to-cart button and there is a product ID, why the need to check the product type? By checking for a specific product type, you are ensuring that NO custom product types will work with your ajax code.

    I have worked around this problem by injecting the classes “etheme_add_to_cart_button” and “product_type_downloadable” into my bundled product button which is fine since it does happen to be a bundled downloadable product.

    Regarding issue 2, since there is not a built-in way to disable the progress bar when an add-to-cart button is clicked, I used CSS to hide it. My question was is there was a built-in way to do this. Clearly not.

    Thank you,

    Steve

    Avatar: Eva
    Eva Kemp
    Support staff
    August 30, 2016 at 15:58

    Hello,

    Sorry, but we don’t provide support for 3rd-party plugins and don’t guarantee their full compatibility with the theme. Our ajax won’t work with that plugin.
    If you want to get Add to cart button working you need disable the option Ajax “Add to Cart” in Theme Options.

    Regards,
    Eva Kemp.

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.