The woocs_fixed_price_user_rope filter passes the price that the "prices based on user role" feature resolved for a product, together with everything used to resolve it. Use it when the role rules stored in the product need an extra condition the interface cannot express — a price that also depends on the order history, on a membership plugin, or on a role combination.
add_filter('woocs_fixed_price_user_rope', function ($value, $post_id, $type, $user_roles) {
if (in_array('wholesale', (array) $user_roles) and $type === 'regular') {
return floatval($value) * 0.9;
}
return $value;
}, 10, 4);
Parameters:
$value - the resolved price, or empty when no role rule matched
$post_id (int) - the product ID
$type (string) - which price is being resolved, regular or sale
$user_roles (array) - the roles of the current user
Returns:
Note: the hook name contains a typo in the plugin source — it is rope, not role. Use the name exactly as written here.