OriginProtocol / dshop

Origin Dshop - launch your own decentralized store
https://www.originprotocol.com/dshop
MIT License
138 stars 87 forks source link

Option to include/exclude taxes from discount #653

Open gullible1 opened 3 years ago

gullible1 commented 3 years ago

Similar to how we allow users to choose whether to include/exclude shipping price from discounts, we should also let them do the same for taxes.

For example:

Currently if a seller sets a 100% off discount code for a Printful product, the buyer still has to pay the tax amount. The seller should have the option to cover taxes as well and have the buyer pay $0.

theprivileges commented 3 years ago

@gullible1 could you help me understand this feature request a bit, please? Is the desired outcome of this issue to:

Is this correct, or have I misunderstood your example?

franckc commented 3 years ago

@theprivileges When the checkbox is selected, the discount should not apply to the taxes. But the taxes should remain in the cart. In some sense it is very similar to the existing option "Exclude Shipping Fees" but for taxes vs shipping.

Here is an example of a cart, assuming both the "Exclude taxes" and "Exclude Shipping Fees" are selected: Subtotal: $100 Taxes: $8.5 Shipping: $5 Discount 10% off: -$10 => Total: $103.5

Notice how the discount only applied to the subtotal and not to the taxes nor the shipping. Let us know any question! 👍

phyninja commented 3 years ago

Hi everyone,

I've implemented the requested feature in separate branch, and am in the process of writing a unit test to confirm that the cart totals are calculated as expected. I do have a concern to bring up at this point:

If a seller chooses to configure Taxes on their UI (from Settings > Checkout), it seems to me like there isn't enough information for them to know how taxes are calculated. For example, how many new sellers would know that in order to generate @franckc's example cart, they would have to set the Tax Rate to 8.5%? In other words, are there places in the world where the norm is that a discount is applied on a product before calculating the tax on that 'final' product price?

franckc commented 3 years ago

@micahalcorn @gullible1 Could you comment on ^^^ ?

phyninja commented 3 years ago

@franckc since I haven't yet seen a response on this thread, I've enabled tooltips on the two checkboxes to inform shop admins of their functionality (screeenshots below); tooltips are displayed when the user's mouse pointer hovers over the options.

Does this work for everyone?


Exclude Shipping - Tooltip


Exclude Taxes - Tooltip

phyninja commented 3 years ago

All,

I'm submitting a Pull Request for review in relation to this issue. If and when that is approved, all related changes will "go live", and be reflected on the user end.

Best, Rajath