Hide or Remove Prices
-
Hi,
I would like to hide all prices of the products if they are 0, when I switch the currency to CRC, then some of the products without price are shown as: ?0
For example:
– Go to https://www.himaxcr.com/shop, if the prices are in $ then everything is fine, no prices are shown for products that doesn’t have any price.– However, if you switch to CRC then you see for all the products with ?0
I tried the following code but it didn’t work either:
function remove_add_cart(){ global $product; if ( has_term( 'Sin Precio', 'product_tag') ){ // removing the purchase buttons remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 ); remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 ); // Remove price remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); } } add_action( 'wp', 'remove_add_cart' );
The above works to remove the add to cart when the price is 0 and product_tag = Sin Precio, however, prices are still shown when switching the currency.
Thank you!
The page I need help with: [log in to see the link]
- The topic ‘Hide or Remove Prices’ is closed to new replies.