Support » Plugin: WooCommerce » Can not add product to cart

  • Resolved SuperBomd


    Hi admin, i used to id product for add to cart,and using this:
    WC()->cart->add_to_cart( $product_id );
    But, when i go to page cart, it is empty, (not login).
    Pls check, and can you help me

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Thomas Shellberg


    Automattic Happiness Engineer

    @ngothoai – Please paste in the full code, please? Are you using the code from here?

    I just tested it and it worked fine; even when I remove the product from the cart(not logged in), it is re-added when the page reloads.

    I would check for any caching on the site(make sure your Cart and Checkout pages are exempt from caching) and test with a default theme(Storefront).

    Plugin Support Kenin


    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can not add product to cart’ is closed to new replies.