Skip to content

Instantly share code, notes, and snippets.

@mikeyarce
Last active December 16, 2016 03:10
Show Gist options
  • Select an option

  • Save mikeyarce/8a07f87c2590bf2bc78aa03727e56adb to your computer and use it in GitHub Desktop.

Select an option

Save mikeyarce/8a07f87c2590bf2bc78aa03727e56adb to your computer and use it in GitHub Desktop.
Remove Sale price from products when using Dynamic Pricing
<?php
// Remove the <?php tag above if your file already includes it
// Remove Sale price from products when using Dynamic Pricing
function marce_remove_sale_dynamic_pricing() {
$WC_Dynamic_Pricing = WC_Dynamic_Pricing::instance();
remove_filter( 'woocommerce_product_is_on_sale', array( $WC_Dynamic_Pricing, 'on_get_product_is_on_sale'), 10, 2 );
}
add_action( 'plugins_loaded', 'marce_remove_sale_dynamic_pricing');
@c00kiemon5ter

Copy link
Copy Markdown

This did not work for me. What I did was:

function wc_dynamic_pricing_do_not_consider_sale_price() {
  if ( class_exists(WC_Dynamic_Pricing) ) {
    function do_not_consider_sale_price($price, $product) {
      return $product->regular_price;
    }
    add_filter( 'woocommerce_get_price', 'do_not_consider_sale_price', 9, 2 );
  }
}
add_action( 'wp_loaded', 'wc_dynamic_pricing_do_not_consider_sale_price' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment