Skip to content

Conversation

namlier
Copy link
Contributor

@namlier namlier commented Apr 19, 2018

Original Pull Request

#13831

Description

In free shipping flow sometimes you can 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

Manual testing scenarios

  1. Setup free shipping rule with Subtotal >= 25.
  2. Setup TableRate shippign method.
  3. Add products to cart.
  4. Apply free shipping coupon.
  5. TableRate shippign method disappears.

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
@magento-engcom-team
Copy link
Contributor

Hi @mastiuhin-olexandr. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants