Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $product = wc_get_product($product_id);
- $attributes = $product->get_attributes();
- foreach($attributes as $key => $attribute) {
- if($ending === $attribute->get_options()[0]) {
- $cart->add_fee('Discount due to being a student at '.$attribute->get_name(), $attribute->get_options()[1]-$product->get_price());
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement