Prevent Customer form removing auto add product in basket
-
Hi together,
I implemented an auto add function in woocommerce that adds a cleaning fix fee to a wheelchair rental.
Now I would like the quantity counter and the removal field to be removed so that the customer cannot remove the fee from the basket.
therefore i umplemented the following function in my functions.php:add_filter('woocommerce_cart_item_remove_link', 'customized_cart_item_remove_link', 20, 2 ); function customized_cart_item_remove_link( $button_link, $cart_item_key ){ $targeted_products_ids = array( 150); $cart_item = WC()->cart->get_cart()[$cart_item_key]; if( in_array($cart_item['data']->get_id(), $targeted_products_ids) ) $button_link = ''; return $button_link; }
Here I adjusted the targeted products_ids array to only apply this on the cleaning fee product.
Unfortunately this does not work and the remove link is still available.
Also I was wondering if there is any possibility to remove the quantity switcher.Many thanks for your support.
Greetings
Andreas
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Prevent Customer form removing auto add product in basket’ is closed to new replies.