Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,244
    Plugin Contributions
    20

    Default Discount Coupon Tax issue

    We came across the following issues when applying Discount Coupons:


    • Fixed amount discount coupons apply more discount than configured eg. £0.20 coupon applied £0.23 discount instead
    • Percentage discount coupons calculate against tax-inclusive prices regardless of tax settings eg. 10% discount on £1.00 + VAT (displayed as £1.20) showed as £0.12 instead of £0.10


    Cause


    When DISPLAY_PRICE_WITH_TAX is set to true, the coupon module incorrectly handles tax in two ways:

    • Base calculation issue: Percentage discounts are calculated against tax-inclusive amounts even when MODULE_ORDER_TOTAL_COUPON_INC_TAX is set to false
    • Final amount issue: Tax is incorrectly added to fixed amount coupons even when MODULE_ORDER_TOTAL_COUPON_INC_TAX is set to false


    Solution


    Two changes are required in includes/modules/order_total/ot_coupon.php

    Fix 1: Base Calculation (Line 683)

    From:

    Code:
    if (DISPLAY_PRICE_WITH_TAX !== 'true') {

    To:

    Code:
    if (DISPLAY_PRICE_WITH_TAX !== 'true' || $this->include_tax !== 'true') {

    Why needed

    This ensures that tax is removed from the base order total when calculating discounts if the coupon module is configured to exclude tax, regardless of how prices are displayed in the store.

    Fix 2: Final Amount (Line 597)

    From:

    Code:
    if (DISPLAY_PRICE_WITH_TAX == 'true' && $coupon_details['coupon_type'] == 'F') {

    To:

    Code:
    if (DISPLAY_PRICE_WITH_TAX == 'true' && $coupon_details['coupon_type'] == 'F' && $this->include_tax == 'true') {

    Why needed

    This prevents tax from being added to the final discount amount for fixed amount coupons when the coupon module is configured to exclude tax. Both fixes ensure the coupon module properly respects the MODULE_ORDER_TOTAL_COUPON_INC_TAX setting throughout all calculations.

    Note:
    This issue was initially noticed in Zen Cart 2.1.0 but may exist in other versions

    Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
    20 years with Zencart !

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,436
    Plugin Contributions
    94

    Default Re: Discount Coupon Tax issue

    Thanks for the report and details! I've created a GitHub PR containing those changes: https://github.com/zencart/zencart/pull/7121

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,436
    Plugin Contributions
    94

    Default Re: Discount Coupon Tax issue

    @Ryk, please see comments made in the GitHub pull request; there are apparently some issues with the suggested changes.

  4. #4
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    225
    Plugin Contributions
    7

    Default Re: Discount Coupon Tax issue

    ... you are moving into a land of both shadow and substance of things and ideas, you have just crossed over into the TWILIGHT ZONE!!!

    A little bit of humor that I think describes the situation well enough... unfortunately.
    A pity I can't add the music.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,320
    Plugin Contributions
    125

    Default Re: Discount Coupon Tax issue

    @Ryk would you please sign off on https://github.com/zencart/zencart/pull/7121 or state objections so it can be dealt with? Thanks.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,436
    Plugin Contributions
    94

    Default Re: Discount Coupon Tax issue

    Quote Originally Posted by swguy View Post
    @Ryk would you please sign off on https://github.com/zencart/zencart/pull/7121 or state objections so it can be dealt with? Thanks.
    Right, otherwise I'm just going to withdraw the PR that I'd submitted on your behalf.

  7. #7
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,244
    Plugin Contributions
    20

    Default Re: Discount Coupon Tax issue

    Sorry - I'm not understanding what you want from me.

    All I know is that we found a problem that appeared to be a ZenCart bug and created a solution which works for us.

    I'll ask our developers to look at github to se4e if further comment is needed.
    Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
    20 years with Zencart !

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,436
    Plugin Contributions
    94

    Default Re: Discount Coupon Tax issue

    Quote Originally Posted by Ryk View Post
    Sorry - I'm not understanding what you want from me.

    All I know is that we found a problem that appeared to be a ZenCart bug and created a solution which works for us.

    I'll ask our developers to look at github to se4e if further comment is needed.
    The solution you provided doesn't work for all store configurations; those are pointed out by @piloujp's comments in the PR I submitted on your behalf.

    For the change to be accepted into the Zen Cart base, the change needs to result in correct calculations for all scenarios.

  9. #9
    Join Date
    Oct 2004
    Location
    Southport, UK
    Posts
    4,244
    Plugin Contributions
    20

    Default Re: Discount Coupon Tax issue

    OK. Well, we had a problem with the core code and found a solution that resolved it for our situation. It would no doubt work for people with the same settings, but we currently do not have the resources to investigate further using condtional settings not applicable to ourselves, especially in the light of piloujp's last comment which seems to indicate that there is a long-standing issue on which a considerable amount of time has already been spent without achieving a full resolution.

    Thank you for looking into this and please do as you wish with our report.
    Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
    20 years with Zencart !

 

 

Similar Threads

  1. v151 Discount coupon and tax issue
    By jayplanedin in forum Bug Reports
    Replies: 0
    Last Post: 28 Mar 2014, 01:59 AM
  2. Replies: 18
    Last Post: 12 Mar 2010, 06:37 PM
  3. discount coupon tax
    By bluesky2008 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 5 Sep 2008, 03:05 PM
  4. Discount Coupon AND Group Discount Tax Problem
    By mrkrinkle in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 11
    Last Post: 5 Apr 2007, 12:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR