• Hi, I’m trying to make a Custom Add to Cart button with Ajax and your plugin but it doesnt work.

    I need help to make Add to cart button on Ajax and after product added the sidebar should be show. I have custom list by WP Query. Below I show my button to add to cart (its adding product to acrt but not on ajax) and if there is class .xoo-wsc-cart-trigger the sidebar is showing but products are not added to cart.

    <a class='button ajax_add_to_cart add_to_cart_button xoo-wsc-cart-trigger' href="?add-to-cart=<?php echo $wc_query->post->ID; ?>">Add to cart</a>

    • This topic was modified 3 years, 4 months ago by matppp.
Viewing 1 replies (of 1 total)
  • Plugin Author xootix

    (@xootix)

    Hello

    You don’t have to add class xoo-wsc-cart-trigger to your button. If the product adds successfully to cart, it will auto open.
    Go to WC settings -> product and make sure “ajax add to cart behavior” is enabled.

    Try this
    <a href="?add-to-cart=<?php echo $wc_query->post->ID; ?>" data-quantity="1" class="button add_to_cart_button ajax_add_to_cart" data-product_id="<?php echo $wc_query->post->ID; ?>">Add to cart</a>

    • This reply was modified 3 years, 4 months ago by xootix.
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Add To Cart Button with Ajax’ is closed to new replies.