roles ) || in_array( 'student', (array) $user->roles )) { $price = $price * get_price_multiplier();}else{ $price = $price;} return (float) $price; } // Variable (price range) add_filter('woocommerce_variation_prices_price', 'custom_variable_price', 99, 3 ); add_filter('woocommerce_variation_prices_regular_price', 'custom_variable_price', 99, 3 ); function custom_variable_price( $price, $variation, $product ) { // Delete product cached price (if needed) wc_delete_product_transients($variation->get_id()); $user = wp_get_current_user(); if ( in_array( 'administrator', (array) $user->roles ) || in_array( 'student', (array) $user->roles )) { $price = $price * get_price_multiplier();}else{ $price = $price;} return (float) $price; } //Hide Price Range for WooCommerce Variable Products add_filter( 'woocommerce_variable_sale_price_html', 'variable_product_price', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'variable_product_price', 10, 2 ); function variable_product_price( $v_price, $v_product ) { // Product Price $prod_prices = array( $v_product->get_variation_price( 'min', true ), $v_product->get_variation_price( 'max', true ) ); $prod_price = $prod_prices[0]!==$prod_prices[1] ? sprintf(__('%1$s', 'woocommerce'), wc_price( $prod_prices[0] ) ) : wc_price( $prod_prices[0] ); // Regular Price $user = wp_get_current_user(); if ( in_array( 'administrator', (array) $user->roles ) || in_array( 'student', (array) $user->roles )) { $regular_prices = array( $v_product->get_variation_regular_price( 'min', true ), $v_product->get_variation_regular_price( 'max', true ) ); $og_price = $regular_prices[0] / 0.917; sort( $regular_prices ); $regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('%1$s','woocommerce') , wc_price( $og_price ) ) : wc_price( $og_price ); }else{ $regular_prices = array( $v_product->get_variation_regular_price( 'min', true ), $v_product->get_variation_regular_price( 'max', true ) ); sort( $regular_prices ); $regular_price = $regular_prices[0]!==$regular_prices[1] ? sprintf(__('%1$s','woocommerce') , wc_price( $regular_prices[0] ) ) : wc_price( $regular_prices[0] ); } if ( $prod_price !== $regular_price ) { $prod_price = ''.$regular_price.$v_product->get_price_suffix() . ' ' . $prod_price . $v_product->get_price_suffix() . ''; } return $prod_price; }