Last active
August 2, 2017 19:52
-
-
Save JeroenSormani/917d73577cdf64cfce1abd3e98b5c60c to your computer and use it in GitHub Desktop.
advanced pricing bust cache user roles
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
<?php | |
// You can copy&paste the contents of the script to your (child) themes functions.php. I recommend doing it over FTP. | |
// Busts the cache for Advanced Pricing > User role based pricing rules | |
add_filter( 'woocommerce_get_variation_prices_hash', function( $hash, $product, $include_taxes ) { | |
$user = wp_get_current_user(); | |
$hash['user_role'] = implode( ',', $user->roles ); | |
return $hash; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment