I am using Tablerates
as my shipping method and the condition is set to Price vs Destination
.
Use case One
Free Shipping over $200
Use case Two
If zip code falls under Zone 1 i.e. 28682-28685, `$20` flat rate shipping fee
Use case Three
If zip code falls under Zone 2 i.e. 28360-28365, `$50` flat rate shipping fee
Below is how my CSV looks like
Country Region/State Zip/Postal Code Order Subtotal(and above) Shipping Price
USA NC 28682 0 20
USA NC 28682 201 0
USA NC 28360 0 50
USA NC 28360 201 0
Upload works, as is reflected in the table shipping_tablerate
as seen in below image
But when user check shipping price on cart
page for zip code whose shipping price should be $20
, it always takes $50
. It can be seen in below image. Currently the user is logged in
Although when Subtotal
goes beyond $200
, it shows shipping price $0
which is correct as per tablerates. Moreover on checkout page, it shows correct shipping price based on zip code selected. It happens only on cart page.
Estimate Shipping and Tax also shows correct shipping price based on zip code entered. But when I click on selected price it throws below exception
/rest/default/V1/carts/mine/totals-information 500 (Internal Server Error)
Below is the response I get
{"messages":{"error":[{"code":500,"message":"Fatal Error: 'Uncaught TypeError: Argument 1 passed to Magento\\Quote\\Model\\Cart\\Totals::setExtensionAttributes()
must be an instance of Magento\\Quote\\Api\\Data\\TotalsExtensionInterface, instance of Magento\\Quote\\Api\\Data\\AddressExtension given, called in \/home\/storeq\/public_html\/vendor\/magento\/framework\/Api\/DataObjectHelper.php on line 125 and defined in \/home\/storeq\/public_html\/vendor\/magento\/module-quote\/Model\/Cart\/Totals.php:592\n
Stack trace:\n#0 \/home\/storeq\/public_html\/vendor\/magento\/framework\/Api\/DataObjectHelper.php(125):
Magento\\Quote\\Model\\Cart\\Totals->setExtensionAttributes(Object(Magento\\Quote\\Api\\Data\\AddressExtension))\n#1 \/home\/storeq\/public_html\/vendor\/magento\/framework\/Api\/DataObjectHelper.php(85):
Magento\\Framework\\Api\\DataObjectHelper->_setDataValues(Object(Magento\\Quote\\Model\\Cart\\Totals), Array, 'Magento\\\\Quote\\\\A...')\n#2 \/home\/storeq\/public_html\/vendor\/magento\/module-quote\/Model\/Cart\/CartTotalRepository.php(103):
Magento\\Framework\\Api\\DataObjectHelper->populateWithArray(Object(Magento\\Quote\\Model\\Cart\\Tota' in '\/home\/storeq\/public_html\/vendor\/magento\/module-quote\/Model\/Cart\/Totals.php' on line 592","trace":"Trace is not available."}]}}
When user is not logged in, it does not show shipping charges, but when user is logged in it always shows in correct shipping price i.e. $50
- How do I resolve this and display correct shipping price on cart page?