I modified a function to create custom prices for some of my members i.e. the normal price is $1 but if you're a bronze member it's $2, a silver member $3, etc.
The prices are changed on the shop and single product page. When the product is added to the cart, however, the price reverts to the original amount. Is there additional code I should be including to have the price accurately changed all the way through checkout and billing?
// Variations (of a variable product)
add_filter('woocommerce_variation_prices_price', 'custom_variation_price', 99, 3 );
add_filter('woocommerce_variation_prices_regular_price', 'custom_variation_price', 99, 3 );
function custom_variation_price( $price, $variation, $product ) {
global $product;
$id = $product->get_id();
$user_id = get_current_user_id();
$plan_id = 1628;
if ( wc_memberships_is_user_member( $user_id, $plan_id ) ) {
$new = $price * 2;
return ($new);
}
}