Skip to content

Tablerate calculates wrong rates #1433

Open
@ulbiopro

Description

@ulbiopro

Preconditions (*)

  1. OpenMage LTS 20.0.6 (I'm pretty sure in every Magento version, at least since CE 1.9.2.4)
  2. (MySQL 5.7.31 / PHP 7.4.9 / Apache 2.4.38 )

Steps to reproduce (*)

I reproduced this on fresh OpenMage LTS 20.0.6 and used the default tax-classes and zones. Nevertheless it happens with custom configuration, too.

  1. Setup: Configure shipping method tablerates with tablerate data below (works with other countries too, but USA is less work to reproduce). Anything less than $50 should include a $3.95 shipping fee, a cart with more than $50 comes with free shipping.
Country,Region/State,"Zip/Postal Code","Order Subtotal (and above)","Shipping Price"
USA,*,*,0.0000,3.9500
USA,*,*,50.0000,0.0000
  1. Setup: Use default item, simple product with a price of 50.00 $, Tax Class = taxable goods (an existing default value)
  2. Setup: Configuration -> Sales -> Tax -> Calculation Settings -> Catalog Prices: Including Tax
  3. Add product to cart. In default Layout you can use the "estimate shipping and tax" box. Since we're using default values, please use state "california" because we have configured tax zones and rates for this state by default.

Bildschirmfoto 2021-01-28 um 12 51 43

As expected, shipping costs are $0.
  1. Proceed to checkout.
  2. Checkout as guest
  3. Fill in billing information. Make sure to use California again and select "Ship to this address"

Bildschirmfoto 2021-01-28 um 13 01 37

  1. Continue -> Shipping Information form will be skipped.
    9. Shipping fee is now $3.95!

Bildschirmfoto 2021-01-28 um 13 01 48

  1. Click "Back"

Bildschirmfoto 2021-01-28 um 13 01 55

  1. Click "Continue"
  2. Shipping fee is now $0 again.

Bildschirmfoto 2021-01-28 um 13 02 00

Shipping fee is also $0, if you select "Ship to different address" in the Billing information.

Expected result (*)

I'm not sure if shipping costs are calculated on prices including or excluding taxes.
Either way, the result should be the same, if you ship to the same address.

Actual result (*)

Shipping costs differ, although both times the sipping address was the same.

Notice

Maybe this information helps, finding the bug:
In step 7 ("ship to this address") Mage_Shipping_Model_Carrier_Tablerate::collectRates() is called 2 times.
The 1. time $request->getPackageValue() returns 50. (Price incl. tax)
The 2. time $request->getPackageValue() returns 46.19. (Price excl. tax)

If you checkout with "ship to different address", Mage_Shipping_Model_Carrier_Tablerate::collectRates() is called only once.
$request->getPackageValue() returns 50.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions