Tax and Excl. Tax is the same when using configurable swatches
-
14-04-2021 - |
题
I'm using Magento 2.3.5, and have noticed my incl/excl tax prices are the same, but only when clicking a swatch (I assume JS somewhere is at fault, but scratching my head)
I've tested disabling all extensions, clearing static files then using Luma, same result.
Image 1: On page load, it's correct (also correct in Cart/Checkout)
Image 2: When a swatch has been clicked. It's like some javascript updates all price elements to the same, but there's no custom js enabled here.
Any help greatly appreciated
解决方案
Turned out it was the tax_class_id attribute setting
I'd migrated this attribute from Magento 1 to Magento 2.
On magento 1, it can have the 'used in product listing: no' and works, on m2 this breaks it.
Solution; 'used in product listing: yes' fixes the configurable and swatch tax calcs.
This was debugged when I saw ->addAttributeToSelect('tax_class_id') somewhere on the price blocks, It made me think that 'used in product listing: no' may prevent that from working (e.g. omit it from collection)