With version 3.0.23 of Table Rate Shipping, one little change has been added to the extension. It is small but it can have a big impact on stores. I am talking about how the shipping rates are calculated.
The story of this change goes all the way back to 2015, when the shipping cost was calculated on the item total, which is the adjusted total after any discounts. However, this was not taking into account taxation. Which led to a new change to fix the issue, but also to calculate shipping costs based on the item price.
This has been recently reverted again to the original way it was, so calculating shipping costs based on the items total after before discounts.It is impossible though to just revert without affecting existing stores, so the developers added a way to calculate shipping costs before discounts.
Add this code to your functions.php file in wp-content/themes/your-child-theme-name/:
This will force the system to calculate shipping costs always on the product prices after discounts. It is particularly useful when you have a free shipping tier that is valid only for orders from a certain amount.
If the shipping is calculated before the discount, they might end up being eligible for free shipping even if their order total is reduced to below the minimum amount required for free shipping.