WooCommerce product custom discounted price for logged in users
问题 I have a question about managing prices in WooCommerce. I have a store only with simple products. Let's say that for all subscribers and customers the regular price of each product is discounted by 10%. This was easy: function custom_price( $price, $product ) { global $post, $blog_id; $post_id = $post->ID; get_post_meta($post->ID, '_regular_price'); if ( is_user_logged_in() ) { return $price = ($price * 0.9); } else{ return $price; } } add_filter( 'woocommerce_get_price', 'custom_price', 10,