Last active
March 8, 2018 17:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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