I’m implementing a Remove Item button next to the add to cart button however I have a problem getting the variable $cart_item_key for a single product. I have the global variables $woocommerce and $product but the only way $cart_item_key is used is a foreach which doesn’t help me at all as I need my code to be added in add-to-cart.php.
Leave a Reply
You must be logged in to post a comment.
You have to set the remove link for each product within loop like this,
In any situation you have cart item listing; from that you have to remove, so
foreach
will work with your requirement.Hope its helps..
This code worked for me. Thanks to Jobin Jose (https://stackoverflow.com/users/1258004/jobin-jose) for the solution!