inventory
inventory copied to clipboard
IsEnabledOptionSelectBuilder does not take store value into account
Preconditions (*)
- Magento Inventory 1.2.7, 1.2.7-p1
Steps to reproduce (*)
- Create a configurable product with colour and size as configurable options.
- Create simple variants for colours Red, Purple and Black, sizes XS, S, M, L and XL
- Disable all variants with size XS at global level
- Enable the same variants at the store level
Expected result (*)
- A graphql call returning
configurable_optionsshould includeXSas a size value
query {
products(
search: "teton"
){
items {
sku
... on ConfigurableProduct {
configurable_options {
attribute_code
label
values {
label
}
}
variants {
product {
sku
}
}
}
}
}
}
{
"data": {
"products": {
"items": [
{
"sku": "MH02",
"configurable_options": [
{
"attribute_code": "color",
"label": "Color",
"values": [
{
"label": "Black"
},
{
"label": "Purple"
},
{
"label": "Red"
}
]
},
{
"attribute_code": "size",
"label": "Size",
"values": [
{
"label": "XS"
},
{
"label": "S"
},
{
"label": "M"
},
{
"label": "L"
},
{
"label": "XL"
}
]
}
],
"variants": [
{
"product": {
"sku": "MH02-XS-Black"
}
},
{
"product": {
"sku": "MH02-XS-Purple"
}
},
{
"product": {
"sku": "MH02-XS-Red"
}
},
{
"product": {
"sku": "MH02-S-Black"
}
},
{
"product": {
"sku": "MH02-S-Purple"
}
},
{
"product": {
"sku": "MH02-S-Red"
}
},
{
"product": {
"sku": "MH02-M-Black"
}
},
{
"product": {
"sku": "MH02-M-Purple"
}
},
{
"product": {
"sku": "MH02-M-Red"
}
},
{
"product": {
"sku": "MH02-L-Black"
}
},
{
"product": {
"sku": "MH02-L-Purple"
}
},
{
"product": {
"sku": "MH02-L-Red"
}
},
{
"product": {
"sku": "MH02-XL-Black"
}
},
{
"product": {
"sku": "MH02-XL-Purple"
}
},
{
"product": {
"sku": "MH02-XL-Red"
}
}
]
}
]
}
Actual result (*)
XSis not returned as a size value:
{
"data": {
"products": {
"items": [
{
"sku": "MH02",
"configurable_options": [
{
"attribute_code": "color",
"label": "Color",
"values": [
{
"label": "Black"
},
{
"label": "Purple"
},
{
"label": "Red"
}
]
},
{
"attribute_code": "size",
"label": "Size",
"values": [
{
"label": "S"
},
{
"label": "M"
},
{
"label": "L"
},
{
"label": "XL"
}
]
}
],
"variants": [
{
"product": {
"sku": "MH02-XS-Black"
}
},
{
"product": {
"sku": "MH02-XS-Purple"
}
},
{
"product": {
"sku": "MH02-XS-Red"
}
},
{
"product": {
"sku": "MH02-S-Black"
}
},
{
"product": {
"sku": "MH02-S-Purple"
}
},
{
"product": {
"sku": "MH02-S-Red"
}
},
{
"product": {
"sku": "MH02-M-Black"
}
},
{
"product": {
"sku": "MH02-M-Purple"
}
},
{
"product": {
"sku": "MH02-M-Red"
}
},
{
"product": {
"sku": "MH02-L-Black"
}
},
{
"product": {
"sku": "MH02-L-Purple"
}
},
{
"product": {
"sku": "MH02-L-Red"
}
},
{
"product": {
"sku": "MH02-XL-Black"
}
},
{
"product": {
"sku": "MH02-XL-Purple"
}
},
{
"product": {
"sku": "MH02-XL-Red"
}
}
]
}
]
}
The cause of the issue is the order variables are passed into the getIfNullSql function here - https://github.com/magento/inventory/blob/a032928522623b6a3df0e0299582667acf785a1a/InventoryConfigurableProduct/Plugin/Model/ResourceModel/Attribute/IsEnabledOptionSelectBuilder.php#L85
The global value is passed first, meaning that the store value is only used if the global value is null (which should never be the case). These should be swapped - the store value should be used, and if it is null, the global value should be used instead.
Hi @aligent-lturner. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
This has been fixed by d5b3ee37d842200b176ae986f7362891e550bed9