Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamra/afcc01fad122689b51ddb1aa13846764 to your computer and use it in GitHub Desktop.
Save iamra/afcc01fad122689b51ddb1aa13846764 to your computer and use it in GitHub Desktop.
WC disable sale on all products.
<?php
/**
* Disable all sales.
*
* A simple function to disable all the sales in the shop.
* Uncomment the line of code to disable the sale price on products.
*/
function custom_wc_get_sale_price( $sale_price, $product ) {
// return $product->get_regular_price(); // Un-comment this to disable all sale prices
return $sale_price;
}
add_filter( 'woocommerce_get_sale_price', 'custom_wc_get_sale_price', 50, 2 );
add_filter( 'woocommerce_get_price', 'custom_wc_get_sale_price', 50, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment