Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
advanced pricing bust cache user roles
<?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
You can’t perform that action at this time.