update action under shopifyProductVariant modal doesn't update real Shopify data
I am calling this update action many places in my app, also will add scheduler too for automatically update product prices. It is updating the modal I can see the new values in the Gadget data, but it's not changing the actual Shopify data, the price I see in online shop. I tried to get help from AI assistant too but lo luck, it just add fancy logs to my code which gets me nowhere. I'm sharing my shopifyProductVariant.update() action.
No lack of permission
4 Replies
Hello,
There are a few things to consider here. You're currently not guarding against infinite update loops. You should check to see if Shopify is returning an error from your mutation. Shopify doesn't throw http errors anymore when something is wrong but they instead add an error to the userErrors array. Here's an example: https://shopify.dev/docs/api/admin-graphql/latest/mutations/metafieldsSet#:~:text=Anchor%20to-,userErrors,userErrors,-%E2%80%A2
Shopify
metafieldsSet - GraphQL Admin
Sets metafield values. Metafield values will be set regardless if they were previously created or not.
Allows a maximum of 25 metafields to be set at a time.
This operation is atomic, meaning no changes are persisted if an error is encountered.
As of
2024-07
, this operation supports compare-and-set functionality to better handle concurrent ...Thanks for the response. I will handle the infinite loop problem. After reviewing the documentation, I solved the main issue. It appears that
productVariantsBulkUpdate
is the ONLY way to update even one product, rather than using productUpdate
or productVariantUpdate
. I am sharing this information for the benefit of beginners who may search for it later.Thats interesting
That must have changed in one of the recent Shopify API versions
Yes, it says 2024-10.
https://shopify.dev/changelog/breaking-changes-in-several-productvariant-related-mutations-in-version-2024-10
Shopify
Breaking changes in several ProductVariant related mutations in ver...
Shopify’s developer changelog documents all changes to Shopify’s platform. Find the latest news and learn about new platform opportunities.