Apply percentage fee based on the post-discount order amount, instead of the list prices

Created on 20 February 2024, over 1 year ago

I have set up a promo/coupon using "Percentage off the order subtotal".

I have a fee set up that is using "Percentage of order subtotal added to the order total" (and I also tried with a fee using "Percentage of each matching product added to the order total", encountering the same issues I outline below).

When I am in the cart and I choose the relevant payment method, the fee is calculated and added correctly.

However, if I then add a discount in the cart, the fee is calculated against the product/cart's pre-discount amount, rather than the product/cart's post-discount amount.

For example, if I have a $100 product in my cart, the fee (5%) is $5. If I then apply a 50% off coupon, I would expect the fee to be reduced to $2.50, since the product total in my cart is now $50, and the fee is supposed to be based on the order's subtotal or the matching products.

Is there a configuration that will accomplish this? If not, what would need to be changed/patched in the code to allow this to work in this fashion?

💬 Support request
Status

Active

Version

1.0

Component

Miscellaneous

Created by

🇺🇸United States hockey2112

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hockey2112
  • 🇮🇱Israel jsacksick

    I think for that it wouldn't be possible with the "Percentage of order subtotal" plugin. But we could potentially support that with the OrderItemPercentage ("Percentage of each matching product added to the order total") plugin.

    We could do this by applying the fee on the top of the adjusted total, like the following:

    So changing this:

        $adjustment_amount = $order_item->getTotalPrice()->multiply($percentage);
    

    to:

        $adjustment_amount = $order_item->getAdjustedTotalPrice(['promotion'])->multiply($percentage);
    

    Though perhaps we should make this configurable... Not sure.

    Maybe this can be turned into a feature request instead.

Production build 0.71.5 2024