Description
Preconditions (*)
- OpenMage LTS 20.0.6 (I'm pretty sure in every Magento version, at least since CE 1.9.2.4)
- (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.
- 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
- Setup: Use default item, simple product with a price of 50.00 $, Tax Class = taxable goods (an existing default value)
- Setup: Configuration -> Sales -> Tax -> Calculation Settings -> Catalog Prices: Including Tax
- 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.
- Proceed to checkout.
- Checkout as guest
- Fill in billing information. Make sure to use California again and select "Ship to this address"
- Continue -> Shipping Information form will be skipped.
9. Shipping fee is now $3.95!
- Click "Back"
- Click "Continue"
- Shipping fee is now $0 again.
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.