Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discount vs. Shipping costs issue #106

Open
trouble2 opened this issue Jun 15, 2020 · 8 comments
Open

Discount vs. Shipping costs issue #106

trouble2 opened this issue Jun 15, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@trouble2
Copy link

We've set free shipping for orders above 200 euro's
However, when someone orders for 220 euro's and get's a discount of 50 euro's the total of the order is 170 euro's.
But the free shipping still applies because it looks at the 220 euro's instead of the 170 euro's.
We think this is wrong.

So at least an option should be built in to apply free shipping on the subtotal or on the total amount.
This way people can choose which way to apply the shipping costs

@leedavi leedavi added the enhancement New feature or request label Jun 15, 2020
@Rdi3n
Copy link

Rdi3n commented Jun 22, 2020

image

So, I have investigated this, and I want to discuss my findings.

I found out that when you have a discount (korting) it gets added to Subtotal, but why?
Subtotal already has the total price which includes the discounted price.

By adding discount to subtotal you showing what the original price would have been but that is not relevant not only that but by adding the discount to subtotal calculating shipping does not work properly. See example above.

If I remove discount from subtotal, I then get 151,38 this means that the client does needs to pay shipping, because free shipping is subtotal >= 250.

So, if we want to show original price, we need to use another field and not subtotal.

How should we proceed?

  1. Do not add discount to subtotal
  2. Open Store wants to show original price, so we need to introduce another field for this
    purpose
  3. Use an exiting field to show original price

Any other suggestions? @leedavi

@leedavi
Copy link
Collaborator

leedavi commented Jun 22, 2020

I'm not sure... but should that discount be a negative figure? Then it would be correct?

Although it is called "discount", the math can dictate it could be a positive or negative amount. And hence displays the sum of the cart, plus discount (negative or positive).

@Rdi3n
Copy link

Rdi3n commented Jun 22, 2020

I'm not following, how can a discount be positive? Discount is always negative. (a deduction from the usual cost of something.)

I think that we should use sum of the cart + tax to calculate shipping. This because cart items already includes the discounted price.

I made the following changes and it seems to be working fine.

Annotation-total1

Annotation-total2

@Rdi3n
Copy link

Rdi3n commented Jun 23, 2020

I went a head and made a few changes.

Annotation-calc

CartTotalFull

shipping

AnnotationshippingGet

So now you can now choose subtotal or cart sum to calculate shipping.

What do you think of this approach? @leedavi

@leedavi
Copy link
Collaborator

leedavi commented Jun 23, 2020

I have not had a deep look.

But I think the trouble here is you change the "CartTotal". I'm unsure of where the CartTotal is used or displayed, but this could cause issues with other areas.

You are best to save the value in another xml element, you can create one called anything you wish. And then change the shipping calculation to use the new value if the option "calc of total" is selected.

We must not effect any other site with the new option. Everything must stay the same for other shops without the option selected, This sounds obvious and easy, but the key word is "separation", do not use any existing variables, if you need the values, copy them to a new XML element.

@leedavi
Copy link
Collaborator

leedavi commented Jun 23, 2020

Also, remember that extra plugins and providers work on the data, so although it all looks OK in the core OpenStore code, it may not be OK in a plugin that uses that value.

The new option path should be completely separate, even if it looks perfectly OK to change the code in the core.

@Rdi3n

This comment has been minimized.

@leedavi
Copy link
Collaborator

leedavi commented Jun 24, 2020

The CartData class inherits the Purchasedata class, which is PurchaseInfo XML.

You can use the nodeXml to add and remove, but it's easier to use a property command, something like this....

PurchaseInfo.SetXmlPropertyDouble("genxml/total2",total)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants