Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default coupon percentage off, free shipping and taxes

    I've just noticed something weird in the discounts calculation and am hoping that someone might tell me if I'm missing something or if it's a bug...

    Using 1.5.4 clean install. For simpler calculation, I've changed Florida tax rate to 10%.
    Created new coupon: 20% off and free shipping.
    Added item in cart (Taxable Goods). Using Flat Rate $5.00 (Taxable Goods). Going to checkout using a Florida address.

    Here are my totals before applying the coupon:
    Sub-Total: 110.97
    Flat Rate (Best Way): $5.00
    FL TAX 10.0%: $11.60
    Total: $127.57

    All good.
    Now I apply the coupon and this is what I get:
    Sub-Total: 110.97
    Flat Rate (Best Way): $5.00
    Discount Coupon: test :-$27.19
    FL TAX 10.0%: $9.38
    Total: $98.16

    I think this is wrong, isn't it? It seems to be adding shipping tax even though shipping is free.
    110.97 + 5 - (22.19 + 5) = 88.78
    10% tax on 88.78 should be 8.88. It seems that it's still adding the 0.50 tax from shipping.

    Here's what I've done to fix it:
    includes/modules/order_total/ot_coupon.php line 419-429
    Code:
    case 'E': // percentage & Free Shipping
                  $od_amount['total'] = zen_round($orderTotalDetails['orderTotal']*($coupon->fields['coupon_amount']/100), $currencyDecimalPlaces);
                  $od_amount['type'] = $coupon->fields['coupon_type'];
                  $ratio = $od_amount['total']/$orderTotalDetails['orderTotal'];
                  // add in Free Shipping
                  $od_amount['total'] = $od_amount['total'] + $orderTotalDetails['shipping'];
                  $od_amount['tax'] = $orderTotalDetails['shippingTax'];
                  if (isset($_SESSION['shipping_tax_description']) && $_SESSION['shipping_tax_description'] != '') {
                    $od_amount['tax_groups'][$_SESSION['shipping_tax_description']] = $od_amount['tax'];
                  }
                  break;
    replace with:
    Code:
    case 'E': // percentage & Free Shipping
                  $od_amount['total'] = zen_round($orderTotalDetails['orderTotal']*($coupon->fields['coupon_amount']/100), $currencyDecimalPlaces);
                  $od_amount['type'] = $coupon->fields['coupon_type'];
                  // add in Free Shipping
                  $od_amount['total'] = $od_amount['total'] + $orderTotalDetails['shipping'];
    			  $ratio = $od_amount['total']/$orderTotalDetails['orderTotal'];
                  $od_amount['tax'] = $orderTotalDetails['shippingTax'];
                  if (isset($_SESSION['shipping_tax_description']) && $_SESSION['shipping_tax_description'] != '') {
                    $od_amount['tax_groups'][$_SESSION['shipping_tax_description']] = $od_amount['tax'];
                  }
                  break;
    Basically, I just moved the $ratio line. Of course, same "patch" needs to be done for case O.

    Now, since this code was written by Ajeh a long time ago (DiscountCombo_v15B.zip), I'm just not sure if I'm missing something obvious and if it's really supposed to calculate that way OR was it just an oversight and a bug?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: coupon percentage off, free shipping and taxes

    Using unmodified code I get:
    Sub-Total: $110.97
    Flat Rate (Best Way): $5.00
    Discount Coupon: 20FREESHIP : -$27.19
    FL TAX 10.0%: $8.88
    Total: $97.66
    What happens if you use the original code without any modifications?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: coupon percentage off, free shipping and taxes

    Quote Originally Posted by Ajeh View Post
    Using unmodified code I get:
    Really? But I WAS using a clean 1.5.4 install. Absolutely no modifications other than tax rate... Demo products.

    Let me do another fresh install and try again.

  4. #4
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: coupon percentage off, free shipping and taxes

    Oh, I obviously forgot to mention it in my first post - shipping is ALSO set to Taxable Goods.

    It's OK if shipping isn't taxable, but if you change Flat Rate to Taxable Goods, you'll see what I'm talking about.

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: coupon percentage off, free shipping and taxes

    On the Modules ... Order Total ... for the Discount Coupon ot_coupon what are your settings?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: coupon percentage off, free shipping and taxes

    Standard clean install - I took the 1.5.4 package and did a new install. The ONLY thing I changed was tax rate from 7% to 10%.

    To answer your question:
    Discount Coupon

    This module is installed
    true

    Sort Order
    280

    Include Shipping
    false

    Include Tax
    false

    Re-calculate Tax
    Standard

    Tax Class
    --none--

 

 

Similar Threads

  1. v151 Free shipping or a percentage off if order is over a certain amount
    By attroll in forum Setting Up Specials and SaleMaker
    Replies: 2
    Last Post: 10 Apr 2014, 12:23 AM
  2. v139b Setting up a percentage off shipping coupon.
    By Tiffany33 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 3 May 2012, 09:33 PM
  3. Replies: 3
    Last Post: 17 Jan 2012, 09:47 PM
  4. Taxes charged on shipping when using free shipping coupon
    By binary in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 8 Sep 2010, 01:53 PM
  5. percentage AND free postage coupon
    By poosk in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 25 Sep 2008, 04:29 PM

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