Problems with setting up delivery costs
-
12-12-2019 - |
Question
I have two options to order a product.
- Pick up yourself (works)
- Delivery, order below 30,- you have to pay 7,- and above there are no delivery costs:
I use Tablerates for this. I have uploaded a CSV and it is correctly done:
Land,Provincie,Postcode,"Subtotaal bestelling (en hierboven)",Verzendkosten
*,*,*,0.0000,7.0000
*,*,*,30.0000,0.0000
Condition; price vs location
When I order below 30,- it adds 7,- thats oké
But when I order above 30,- (subtotal) it still adds the 7,-
I cleared cache etc etc. Is there something I could have missed?
version 1.7.0.2
Solution
The problem can be the tax. If you order something for $ 35, and your taxes are 21%, it calculates the order total by 27.25. So it doesnt fit in your free shipping rate.
in app/code/core/mage/shipping/model/carrier/Flatrate.php add the following code (around line 104)
// exclude Virtual products price from Package value if pre-configured
if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
foreach ($request->getAllItems() as $item) {
if ($item->getParentItem()) {
continue;
}
if ($item->getHasChildren() && $item->isShipSeparately()) {
foreach ($item->getChildren() as $child) {
if ($child->getProduct()->isVirtual()) {
$request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
}
}
} elseif ($item->getProduct()->isVirtual()) {
$request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
}
}
}
//////////// add this piece of code ////////////
if (Mage::helper('tax')->priceIncludesTax()) {
$taxableAmount = 0;
foreach ($request->getAllItems() as $item) {
$taxableAmount += $item->getTaxableAmount();
}
$request->setPackageValue($taxableAmount);
//////////// till here ////////////
}
// Free shipping by qty
$freeQty = 0;
if ($request->getAllItems()) {
$freePackageValue = 0;
These are the rates Im using for a costumer, They had the same problems. When a costumer ordered something for 52,95, the shipping was not free, after adding the above code it was
Land,Provincie,Postcode,"Subtotaal bestelling (en hierboven)",Verzendkosten
BEL,*,*,0.0000,6.9500
BEL,*,*,49.9900,0.0000
DEU,*,*,0.0000,4.9500
DEU,*,*,49.9900,0.0000
NLD,*,*,0.0000,4.9500
NLD,*,*,49.9900,0.0000