• Resolved devriesrjj

    (@devriesrjj)


    I created a WordPress website using Sober theme and WooCommerce. Whenever I try to add products to my cart from a single product page, the counter of the shopping cart briefly increments, and then goes back to zero. Can you guys help me with this?

    There’s a small form on the product page, using an action and a value which should add the product to the cart. I programmatically changed this action to point to the product page and add the product ID. Whenever this action contains the url of the product page itself, it still doesn’t work. But when I point to the homepage, together with a query param add-to-cart and the product ID, it does seem to work.

    The code I wrote is just a snippet to experiment with in the console.

    The website is https://partystarterkit.nl/

    And my code is:

    const value = document.querySelector(“.cart > input”).value;
    document.querySelector(“.cart”).action = ${window.location.href}/?add-to-cart=${value};

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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Product not added to cart WooCommerce’ is closed to new replies.