• Resolved mariosmode

    (@mariosmode)


    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    Have you already solved it yourself? If so, please do let us know so that others can use this thread for future help.

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @mariosmode

    Did you find a solution to this?

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/

    We haven’t heard back from you in a while, so I’m going to mark this as resolved, but others can still comment if they have a solution.

    If you have any further questions, you can start a new thread.

    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to retrieve the highest shipping class in cart’ is closed to new replies.