Skip to content

Conversation

irs
Copy link

@irs irs commented Feb 23, 2018

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-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 23, 2018

CLA assistant check
All committers have signed the CLA.

@miguelbalparda
Copy link
Contributor

Thanks for the submission @irs! Have you seen any reports of this?

@irs
Copy link
Author

irs commented Mar 14, 2018

@miguelbalparda no, but I did not search a lot.

@magento-engcom-team
Copy link
Contributor

@irs thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-team magento-team merged commit 2e740ec into magento:2.2-develop Apr 5, 2018
@sidolov
Copy link
Contributor

sidolov commented Apr 6, 2018

Hi @irs , consider porting this solution to other Magento versions.
Recently our team introduced a simple way to port fixes across versions, details available here

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.

6 participants