OFFLINE-GmbH / oc-mall-plugin

:convenience_store: E-commerce solution for October CMS
https://offline-gmbh.github.io/oc-mall-plugin
MIT License
167 stars 112 forks source link

Discount application ordering and priority #888

Open chrisvidal opened 2 years ago

chrisvidal commented 2 years ago

I think this is a problem with ordering and priority of application of discounts.

Let's say we have a discount 'FREE SHIPPING' for any order total above 50$. Let's say we have a cart containing items for a total price of 55$. So the free shipping will apply. Let's say the customer apply a discount code giving him back 10$. So the new order total is 45$.

But the FREE SHIPPING stills applies automatically, and I guess it shouldn't since the total is now 45$.

EDIT: using MALL 1.13.5 and October v1 (472)

martinkuch commented 2 years ago

Discount coupons are calculated for products total price not for whole order, I believe.

chrisvidal commented 2 years ago

yes indeed but this is not the issue at play here. The issue is that the alternate shipping still applies when it should not.

chrisvidal commented 2 years ago

my bad, I just realized my mistake.

It is not an alternate shipping discount that is applied, it is a shipping method that becomes available when the order is above a certain amount.

So, still the problem appears as the shipping method appears even after the application of the discount code.

image

chrisvidal commented 2 years ago

any updates on this please?

georgij- commented 8 months ago

Hi @chrisvidal

I've had a similar issue, ended up modifying this line of code here,

https://github.com/OFFLINE-GmbH/oc-mall-plugin/blob/98a5028b854699fca1bf7e07e36be9a6cd13db8c/models/ShippingMethod.php#L157

Where I've subtracted the discount total, so the correct shipping method will return.

Then, the $total variable is sent here,

https://github.com/OFFLINE-GmbH/oc-mall-plugin/blob/98a5028b854699fca1bf7e07e36be9a6cd13db8c/models/ShippingMethod.php#L196

Where it would return the correct shipping method.