Skip to content
Advertisement

Hide “remove item” and “quantity input” from cart in WooCommerce

On the WooCommerce cart page I want to hide:

  • “remove item” button
  • “quantity input” field

For items that will go in the comment of // HIDE REMOVE BUTTON & QUNATITY OF THESE ITEMS in the code below

JavaScript

Can someone walk me through how to do that?

Advertisement

Answer

A first option is to hide these fields via jQuery and CSS. You could use various hooks on the cart page, like the woocommerce_before_calculate_totals action hook.

Note: because all table rows of shop_table contain the same classes, the correct button/field is hidden based on the product ID.

  • Explanation via comment tags added in the code
JavaScript

Another option is to hide the remove button via the woocommerce_cart_item_remove_link filter hook. So it depends on your preference and ultimate goal, you could then apply something similar for the quantity field.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement