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
Post a Comment