Skip to content

Commit 3826c60

Browse files
Vadim KusakinMastiuhin Oleksandr
authored andcommitted
Fixed comparison with 0 bug for TableRate shipping carrier
In free shipping flow sometimes you ca get such query to DB: SQL: SELECT `shipping_tablerate`.* FROM `shipping_tablerate` WHERE ... BIND: array ( ':website_id' => 1, ':country_id' => 'US', ':region_id' => 12, ':postcode' => '68138', ':condition_name' => 'package_value', ':condition_value' => -3.5527136788005009E-15, ) AFF: 0 It leads to disabled TabelRate shipping method. Such value is calculated in Magento\OfflineShipping\Model\Carrier\Tablerate::collectRates(). Smth like: 29.95 - 10 - 19 - .95 = -3.5527136788005009E-15 and normally should be rounded before comparison. See http://php.net/manual/en/language.types.float.php
1 parent 35324e5 commit 3826c60

File tree

1 file changed

+1
-1
lines changed
  • app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate

1 file changed

+1
-1
lines changed

app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/RateQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getBindings()
9999
}
100100
} else {
101101
$bind[':condition_name'] = $this->request->getConditionName();
102-
$bind[':condition_value'] = $this->request->getData($this->request->getConditionName());
102+
$bind[':condition_value'] = round($this->request->getData($this->request->getConditionName()), 4);
103103
}
104104

105105
return $bind;

0 commit comments

Comments
 (0)