Advertisement
xah

Trials

xah
Jun 9th, 2020 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. add_filter( 'woocommerce_variation_prices', 'custom_price', 10, 2 );
  2.  
  3. function custom_price($price, $product) {
  4.     if (!is_user_logged_in()) return $price;
  5.  
  6. $user = wp_get_current_user();
  7.  $roles = ( array ) $user->roles;
  8.  return $roles;
  9.  
  10.     if ( $roles = 'Administrator' ){
  11.             $price = $price * 0.5;
  12.     }
  13.  
  14.     return $price;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement