php - I want to display different prices for logged in (wholesale) and logged out (retail) customers in woocommerce website -


i developing e-commerce website, want display different price loggedin users , different loggedout users. can please let me know how can in woocommerce.

you need custom code. gets placed in theme functions.php file or custom plugin code.

function custom_get_price( $price, $product  ) {     $discount = 0.5;     if( is_user_logged_in() )         $price = $price * $discount;      return $price; } add_filter( 'woocommerce_get_price', 'custom_get_price',10,2); 

this code hooks woocommerce get_price() function in abstract-wc-product.php file.

some resources on adding custom code wordpress


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -