Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. $product = wc_get_product($product_id);
  2. $attributes = $product->get_attributes();
  3. foreach($attributes as $key => $attribute) {
  4. if($ending === $attribute->get_options()[0]) {
  5. $cart->add_fee('Discount due to being a student at '.$attribute->get_name(), $attribute->get_options()[1]-$product->get_price());
  6. break;
  7. }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement