You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While creating the custom shipping method and shipping rule if you set the shipping rule "Order Total Weight" -> "Maximum" to 10000 and both "Minimum Total Shipping Cost" and "Maximum Total Shipping Cost" to 8, the following error will be thrown:
Cannot assign string to property craft\commerce\models\ShippingRule::$maxWeight of type float in
/vendor/craftcms/commerce/src/controllers/ShippingRulesController.phpat line 129
Steps to reproduce
Create a new Shipping method
Click on a " + New shipping rule" button
Inside "Conditions" tab set "Order Total Weight" maximum value to 10000
Inside "Costs" tab set "Minimum Total Shipping Cost" to 8 and "Maximum Total Shipping Cost" to 8
Click on Save
Expected behavior
Should create a new shipping rules with the following parameters
Actual behavior
Throws an error (see screenshot)
P.S: It seems to create a new shipping rule when you return to the shipping method page, but it also returns an error when you try to delete this shipping rule (see screenshot)
P.S.S: It seems to work fine if you set the "Order Total Weight" maximum value to lower values (for ex. 10)
Screenshots:
Craft CMS version
Craft Pro 4.0.3
Craft Commerce version
4.0.1
PHP version
8.1.6
Operating system and version
Darwin 21.4.0
Database type and version
MySQL 8.0.29
Image driver and version
GD 8.1.6
Installed plugins and versions
The text was updated successfully, but these errors were encountered:
I am currently experiencing this issue as well. The function Craft::$app->getFormatter()->asDecimal() will return a string, which is used to assign to properties of type float. Besides the maxWeight mentioned above, it will fail for other float types as well as $variables['shippingRule']->{$attr} loops over the properties.
What happened?
Description
While creating the custom shipping method and shipping rule if you set the shipping rule "Order Total Weight" -> "Maximum" to 10000 and both "Minimum Total Shipping Cost" and "Maximum Total Shipping Cost" to 8, the following error will be thrown:
Steps to reproduce
Expected behavior
Should create a new shipping rules with the following parameters
Actual behavior
Throws an error (see screenshot)
P.S: It seems to create a new shipping rule when you return to the shipping method page, but it also returns an error when you try to delete this shipping rule (see screenshot)
P.S.S: It seems to work fine if you set the "Order Total Weight" maximum value to lower values (for ex. 10)
Screenshots:
Craft CMS version
Craft Pro 4.0.3
Craft Commerce version
4.0.1
PHP version
8.1.6
Operating system and version
Darwin 21.4.0
Database type and version
MySQL 8.0.29
Image driver and version
GD 8.1.6
Installed plugins and versions
The text was updated successfully, but these errors were encountered: