WooCommerce Remove <del> <ins> Tag and Show Regular Price Only
Use following code to remove all inside <del> and <ins> tag and show regular price only.
Method:
- Copy code to your functions.php.
/* Remove tags*/ add_filter('woocommerce_get_price_html', 'bas_sale_price', 10, 2); function bas_sale_price($price,$product){ $price = ''; if($product->price > 0){ if($product->is_on_sale() && isset($product->regular_price)){ $price .= woocommerce_price($product->get_price()); }else{ $price .= woocommerce_price($product->get_price()); } }elseif($product->price === ''){ $price = apply_filters('woocommerce_empty_price_html','',$product); }elseif($product->price == 0){ if ($product->is_on_sale() && isset($product->regular_price)){ $price .= $product->get_price_html_from_to($product->regular_price, __('Free!','woocommerce')); }else{ $price = __('Free!','woocommerce'); } } return $price; }
2 comments:
Man, you saved me!
Thank you very much!
Thanks so much for sharing!
Post a Comment