What can we help you with?
How to hide striked out price on Product and Shop page in Dynamic Pricing and Discounts Plugin for WooCommerce? (Code Snippet)
When you apply discount to product(s), WooCommerce, by default, shows the sale price with regular price stricken out. This characteristic can be seen in shop page, product page, cart page as well as checkout page. With the code snippet given below, you can choose to hide striked out price on product, shop and category page, with the help of our Dynamic Pricing and Discounts plugin for WooCommerce.
Code snippet to hide strike out price on product and shop page
add_filter('woocommerce_get_price_html', "xa_only_sale_price", 99, 2); function xa_only_sale_price($price, $product) { if(!is_cart() && !is_checkout() && !is_ajax()){ if ($product->is_type('simple') || $product->is_type('variation')) { return regularPriceHTML_for_simple_and_variation_product($price, $product); } } return $price; } function regularPriceHTML_for_simple_and_variation_product($price, $product){ return wc_price($product->get_price()); }
Following is a screenshot of how the product price will be shown on product page.
Following is a screenshot of how the price will be shown on cart page.
To know more about the product, checkout ELEX Dynamic Pricing and Discounts Plugin for WooCommerce.
To know more about other features of the plugin, read product setting up article.
Or checkout documentation section for more related articles.
5 Comments. Leave new
Hi, hello.
How to remove the dash/strike line from regular price
Thank you
Regards
Edo
Hi
Do you want to display both regular price and sale price unstruck?
It would be great if you can share screenshots to explain what you are trying to achieve.
How to remove the strikeout prices in the catalogus and in the single product page?
I just bought this plugin for only that function.
But it is not working.
Hello Jelle,
Thanks for reaching out. Please find the below code snippet for hiding the price strikeout on the shop and product page
https://elextensions.com/knowledge-base/how-to-hide-striked-out-price-on-product-and-shop-page-in-dynamic-pricing-and-discounts-plugin-for-woocommerce/
So this is only working on the product page.
Not on the shop page. Is there any support to help me?