I am trying to change the price for one logged in customer for one product. When using this code, the price does change, but only on the product page. I need the price to change everywhere (archive, product page, cart etc.)
Here's the code that I am trying to make work.
add_filter( 'woocommerce_product_get_price', 'special_discount_for_product_cat_for_logged_in_customers', 10, 2 );
function special_discount_for_product_cat_for_logged_in_customers( $price, $product ) {
$current_user_id = get_current_user_id();
if( $current_user_id == 433 && is_user_logged_in() ) {
if (is_product( '11323', $product->get_id())) {
$price = 9.95;
}
}
return $price;
}
Any help is appreciated.