We recently had a client that wished to have their free shipping rule be triggered on the subtotal of the entire order, including tax. The solution was fairly simple to implement.
By default their rules were calculating shipping rates based on the subtotal of non-taxed goods. So even though their taxed subtotal was $39.99, their total with tax was over $40. The problem is that their free-shipping rule would not take into consideration the $40 sub-total with tax.
The solution was very easy. We just need to create and copy a localized version of the Magento core file Tablerate.php. So in our folder app\code\local\Mage\Shipping\Model\Carrier, we just copied the “Tablerate.php”.
In the file right after (Line 32ish)
if (!$request->getConditionName()) { $conditionName = $this->getConfigData('condition_name'); $request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name); } |
if (!$request->getConditionName()) {
$conditionName = $this->getConfigData(‘condition_name’);
$request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name);
}
Just add:
//stech 81415: Set the package value to be the subtotal of the order. This will ensure tax is used to calculate freeshipping $request->setPackageValue($request->getBaseSubtotalInclTax()); |
//stech 81415: Set the package value to be the subtotal of the order. This will ensure tax is used to calculate freeshipping
$request->setPackageValue($request->getBaseSubtotalInclTax());
This forces the package value to be set using the Base Sub Total WITH Tax, thereby triggering the free shipping rule on that value.
Fix is simple to implement and efficient.
If you have any complicated shipping rule questions or Magento Integration programming needs, Silva Tech Solutions is always available to help you out with whatever problem you may have! Contact Us Now!