beginner115
beginner115

Reputation: 167

Hide striked(and then discounted) Price in woocommerce single product variation product

I am failing to get the correct hook to get rid of this kind of prices →

enter image description here

in woocommerce single product page.

I tried many that were available on the Internet, but could not get rid of any of the remove_action

Upvotes: 1

Views: 710

Answers (1)

mujuonly
mujuonly

Reputation: 11861

Try below code snippet.

add_filter('woocommerce_get_price_html', "wt_hide_regular_price", 99, 2);

function wt_hide_regular_price($price, $product)
{
    if(!is_cart() && !is_checkout() && !is_ajax()){
        if ($product->is_type('simple') || $product->is_type('variation')) {
            return wt_regular_price_for_product($price, $product);
        } 
    }
        return $price;            

}

function wt_regular_price_for_product($price, $product){
    return wc_price($product->get_price());
}

Upvotes: 1

Related Questions