Pr is changing the product variant actions, now it's using SKU as the first option for variant update actions:
for example setAttribute action documentation explains it :
variantId - Number or sku - String - Required
Why we needed it?
We have lots of these kinds of errors: A staged variant with variantId '3' does not exist... I checked one of the product and it indeed doesn’t have that variant. I also checked the history of that product in master because I thought that the product could have before 3 variants and then one got removed. But it always has 2 variants. So it’s weird that we try to update with variant 3 when this variant never existed.
It might not resolve the issue for us but could help with finding the reason.
Error message from the API:
{
action: {
action: "setAttribute"
name: "attributeName"
staged: true
value: [
0: "AU:0"
1: "DE:0"
2: "FR:0"
3: "NL:0"
4: "NZ:0"
]
variantId: 3
}
actionIndex: 7
code: "InvalidOperation"
message: "A staged variant with variantId '3' does not exist."
}
Review Note: I did not add additional tests for the case, currently the cases already covered, so I just updated the existing ones.
Coverage increased (+0.06%) to 97.725% when pulling e8462920f582e80ee06a138b90d91c59762a80f7 on use-sku-as-first-option-for-attribute-update-actions into ae2272485b9a4c25ba8d433ad2e02dedb8dd72f5 on master.
Summary:
Pr is changing the product variant actions, now it's using SKU as the first option for variant update actions:
for example
setAttribute
action documentation explains it :variantId - Number or sku - String - Required
Why we needed it?
We have lots of these kinds of errors: A staged variant with variantId '3' does not exist... I checked one of the product and it indeed doesn’t have that variant. I also checked the history of that product in master because I thought that the product could have before 3 variants and then one got removed. But it always has 2 variants. So it’s weird that we try to update with variant 3 when this variant never existed.
It might not resolve the issue for us but could help with finding the reason.
Error message from the API:
Review Note: I did not add additional tests for the case, currently the cases already covered, so I just updated the existing ones.