Description
Preconditions and environment
- Magento version: 2.4.6, 2.4.7, 2.4.8
Description (*)
So, in Magento 2, when you create a custom attribute of type Price, it automatically gets the Store View scope by default. We can notice this either in the database or when looking at the attribute grid (Screenshot 2). While creating the price attribute, Magento doesn’t give any option to change the scope manually.
There is a setting in the admin panel under Stores > Configuration > Catalog > Catalog > Price > Catalog Price Scope (Screenshot 3), where we can set whether prices should be scoped globally or by website. Logically, we expect any new price attribute to automatically pick up whatever is set there. But it doesn’t work that way.
If you create a price attribute, Magento will still assign it the Store View scope. However, if you go into that configuration and simply click Save (even without changing anything), and then check the scope of the newly created attribute, it will now be set according to the configuration. So basically, unless you save the price scope setting at least once, Magento doesn't apply it to new price attributes. That inconsistency can be a problem because it creates mismatches in how price data is handled, especially across different store views or websites.
(Note: If we assign this attribute to a product or use it elsewhere, it will follow the scope defined in the configuration. That’s why this issue hasn’t been noticed until now.)
Steps to reproduce
- Navigate to Stores > Configuration > Catalog > Catalog > Price > Catalog Price Scope and set the value to either Website or Global.
- Create a new custom attribute of type Price.
- Check the attribute scope in the admin grid or directly in the database (It will be Store View).
Expected result
The price attribute scope should match the value set in the configuration: Stores > Configuration > Catalog > Catalog > Price > Catalog Price Scope either Website or Global).
Actual result
When a price attribute is created and saved for the first time, its scope is incorrectly set to Store View, regardless of the configured setting.
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status