I'm using woocommerce for my website, I want to hide "remove this item/product" for one particular item, can you please tell me how can I do so.
I would greatly appreciate any help towards this.
I'm using woocommerce for my website, I want to hide "remove this item/product" for one particular item, can you please tell me how can I do so.
I would greatly appreciate any help towards this.
You can use a hook to tie into the link action and remove it for specific SKUs, something like the following, though untested it should work.
You could also just use
strpos
on the SKU but it would possibly trigger on other pats of the URL. You can also change the data-product_sku to data-product_id to search by ID instead.Updated (for multiple product Ids in an array)
Here is the correct way to disable/remove the "Remove this item" button, for a specific product ID (that you should define) in the code below:
Code goes in function.php file of the active child theme (or active theme).
Tested and works.