• I am using a theme for my wordpress site in which I am using a module “Call to action”. In its button, I am using a link for one of the products. When I click on this link, page gets refresh and the product gets added in to the cart with view cart option. I want it to work it without refreshing the page. How can I add a custom “add to cart” url in that button for the selected product that it will work with AJAX and product gets added in cart without refreshing the page?

    I provided a link below which has a table of products first. It is working fine with AJAX as it is created using a plugin but at the end of the page, there is a single product with “Add” button which has the issue.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here is a code that might help you to fix this issue.
    use following code to generate the add to cart button,

    global $post; // Assuming it's already set up
    $_product = &new woocommerce_product( $post->ID );
    
    woocommerce_template_loop_add_to_cart( $post, $_product );
    Thread Starter poppins0294

    (@poppins0294)

    I am not sure how to use this code. Where and how should I apply it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Regarding Ajax feature for Add to cart url’ is closed to new replies.