I need to hide prices throughout a whole woocommerce store but keep the 'add to cart' button and checkout functionality operational (the store is set to complete the order without an online payment, to request a quote for the items in the order). I'm using two lines of code to hide the prices in all shop and category pages as well as the single product pages but I can't manage to hide it in the cart and checkout pages.
Here's my code:
add_filter( 'woocommerce_is_purchasable', '__return_true' );
add_filter( 'woocommerce_get_price_html', '__return_empty_string' );
What can I add to hide the prices in the checkout and cart pages?
I need to hide prices throughout a whole woocommerce store but keep the 'add to cart' button and checkout functionality operational (the store is set to complete the order without an online payment, to request a quote for the items in the order). I'm using two lines of code to hide the prices in all shop and category pages as well as the single product pages but I can't manage to hide it in the cart and checkout pages.
Here's my code:
add_filter( 'woocommerce_is_purchasable', '__return_true' );
add_filter( 'woocommerce_get_price_html', '__return_empty_string' );
What can I add to hide the prices in the checkout and cart pages?
Share Improve this question asked Mar 14 at 0:20 ÑakoÑako 774 bronze badges1 Answer
Reset to default 2To hide the prices in Cart and Checkout page, you will need to add multiple filters, as prices are displayed in various parts of the store, each having its own filter or hook.
Here is a list of all WooCommerce Action & Filter Hooks.
So by using your apprach, you can effectivly hide these elements, by returning an empty string/array:
/* Hooks to hide prices in cart and checkout pages */
/* Hides the prices by returning an emtpy string/array */
// Hide the price of individual items in the cart
add_filter( 'woocommerce_cart_item_price', '__return_empty_string' );
// Hide the subtotal of individual items in the cart
add_filter( 'woocommerce_cart_item_subtotal', '__return_empty_string' );
// Hide the subtotal of all items in the cart
add_filter( 'woocommerce_cart_subtotal', '__return_empty_string' );
// Hide the total price of all items in the cart
add_filter( 'woocommerce_cart_total', '__return_empty_string' );
// Hide tax in the cart and checkout pages
add_filter( 'woocommerce_cart_tax_totals', '__return_empty_array' );
However, you should be aware of that this will not hide the prices from the customer order emails.