WordPress Woocommerce remove product programmatically

WordPress Woocommerce remove product programmatically, the proper and WORKING! way of removing a product from cart. I know you looked a lot. Found some solutions but they didn’t work.
The search is over my friend here you go.


  • I keep getting the spinning circle when i try to remove an Item form my cart, on-and-on, when i refresh the page, the item is removed. any suggestions?

    • metin

      not really sure, haven’t had that did you try to uncomment that line if its an ajax call?

  • Vanessa Torres

    I’m sorry.. Where do you actually put this code at? I mean, file.

    • metin

      I put it in functions.php as long as I can remember. Haven’t done wordpress in a while. You should note that this post is only for the logic of WooCommerce.
      So make sure to look for making a custom ajax call or a regular call in wordpress and use this logic in there. That means you will have to use 1 or 2 extra functions.
      I’ll post an example if I find the backup I made 2 years ago 🙂

Recent Posts

Recent Comments

Categories