Skip to content

Instantly share code, notes, and snippets.

@xadapter
Last active March 8, 2018 17:05
Show Gist options
  • Save xadapter/c663d9a972324d360ec6d7268a233155 to your computer and use it in GitHub Desktop.
Save xadapter/c663d9a972324d360ec6d7268a233155 to your computer and use it in GitHub Desktop.
Hide striked out price on Product and Shop pages with Xadapter WooCommerce Dynamic Pricing and Discounts plugin
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());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment