craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
218 stars 170 forks source link

[4.x]: `perItemDiscount` weird behaviour #2937

Closed vandres closed 2 years ago

vandres commented 2 years ago

What happened?

Description

I think this might be related to i18n. My user is set to German, the base currency is EUR.

When working with Money fields, usually we see a "," as decimal separator in the CP. The perItemDiscount though works weirdly for us. When I enter a number with ",", it works fine. Lets say "12,5" But when I reopen the discount rule, the field says "12.5". Which is theroretically the thousand separator. When I resave the field, the field says now "125", which is also used as a value. We tested only this field, maybe others are also affected.

In the same dialog "CMD/Ctrl + S" ist not working. After saving like this, the rule is left back to the overview.

Steps to reproduce

  1. Create a discount rule

Expected behavior

Actual behavior

Craft CMS version

4.2.1.1

Craft Commerce version

4.1.0

PHP version

8.1

Operating system and version

MacOS, Debian Docker

Database type and version

MariaDB 10.5

Image driver and version

-

Installed plugins and versions

  "require": {
    "craftcms/cms": "^4.2.0.2",
    "craftcms/commerce": "^4.1",
    "craftcms/redactor": "^3.0",
    "firephp/firephp-core": "^0.5.3",
    "mmikkel/cp-field-inspect": "^1.4",
    "nystudio107/craft-vite": "^4.0",
    "php-http/curl-client": "^2.2",
    "spicyweb/craft-neo": "^3.2",
    "typesense/typesense-php": "^4.8",
    "vaersaagod/geomate": "^2.0",
    "verbb/expanded-singles": "^2.0",
    "verbb/field-manager": "^3.0",
    "verbb/tablemaker": "^4.0",
    "verbb/wishlist": "^2.0",
    "vlucas/phpdotenv": "^5.4.0"
  },
  "require-dev": {
    "roave/security-advisories": "dev-master",
    "deployer/deployer": "^7.0",
    "yiisoft/yii2-shell": "^2.0.3"
  },
pdaleramirez commented 2 years ago

Thank you for reporting this issue. We'll be working on a fix for this.

pdaleramirez commented 2 years ago

@vandres Fixed now on Commerce v4.1.2

vandres commented 2 years ago

@pdaleramirez Thank you! Can confirm that's working now :)