How to retrieve the highest shipping class in cart
-
I’m trying to add a 50% discount to all shipping classes in cart other than the highest shipping class.
If I have 3 products in the cart, each with its own shipping class pricing like P1=$150; P2=$200; P3=$300. Expected sum of shipping costs would be: (P1/50%)+(P2/50%)+P3(most expensive)= $475
I wrote a function to discount a specific class via shipping class slug. But I don’t know how to retrieve the highest (most expensive) shipping class in a cart and discount all other shipping classes by 50%, because each time there may be a different shipping class (with different slug) in a cart that is most expensive.
Is there a method to discount all shipping class prices on cart other than the most expensive one?
- The topic ‘How to retrieve the highest shipping class in cart’ is closed to new replies.