Modifying Product variant details inconsistent

Topic summary

Issue: A new Shopify and JavaScript user can create a product but experiences inconsistent updates when modifying its variant via the Shopify API.

  • Goal: Create a product, capture its variantId, then update the variant’s title and price using variants/{variantId}.json.
  • Method: Both API calls are executed within a single function.
  • Result: Product creation consistently succeeds; the variant update only succeeded once and is otherwise inconsistent.
  • Key terms: variantId (identifier for a specific product variant); variants/{variantId}.json (Shopify endpoint to update variant details like title and price).
  • Status: No solution provided; the user asks what might be missing or causing the inconsistent variant updates. Discussion remains open with unanswered questions.
Summarized with AI on January 19. AI used: gpt-5.

Hello,

I am new to shopify and new to javascript as well.

What I am trying to achieve is:

  1. Create a product and take the variantId from it.

  2. Use that variantId and call the variants/{variantId}.json API to modify the title and the price.

I have called both endpoints in one function, and it worked for Creating product, however, the inconsistencies are being seen on Variants. There was only once that the variant update works.

What am I missing?