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 a
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.
function my_woocommerce_cart_item_remove_link($link){
preg_match('/data-product_sku=\"(.*?)\"/', $link, $matches);
if($matches[1] == 'PRODUCT_SKU_TO_TRIGGER')
return '';
return $link;
}
add_filter('woocommerce_cart_item_remove_link', 'my_woocommerce_cart_item_remove_link');
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.