Need Help Automatically Publishing & Attaching Metaobjects via Custom Front‑End Form Using GraphQL

Hi everyone,

I’m building a custom front‑end product upload form that allows me to create products in Shopify along with associated metaobjects for additional product details (such as pairings, flavor notes, country/region, cultivar, and cooking methods). I’m using a Node.js/Express server with Shopify’s GraphQL API exclusively (I’ve moved away from REST to avoid deprecation concerns).

What I’m Trying to Do:

  1. Product Creation:
  • I create a product using the productCreate GraphQL mutation (using title and descriptionHtml).
  • I then update the default variant’s price with a separate mutation (e.g., productVariantUpdate), though I’m encountering errors regarding this mutation’s availability.
  1. Attaching Metaobjects:
  • I’ve pre‑created and published metaobject entries in Shopify (for example, for types “pairing”, “flavor_notes”, “country_region”, “cultivar”, and “cooking_methods”). Their handles follow a normalized format (e.g. “cured-meat”, “cornicabra”, “libya”, etc.).
  • After creating the product, my server code queries for these metaobjects using a normalized handle and then attaches them to the product using the metafieldsSet mutation.
  • Depending on the metafield type, I either attach a single metaobject reference or a list of references.

The Issue:
Despite following the documentation and my understanding of the GraphQL schema, I’m encountering multiple issues:

  • Variant Update Errors: When attempting to update the product variant’s price, I receive an error stating that the field productVariantUpdate doesn’t exist on type Mutation.
  • Metaobject Attachment Errors: When attaching metaobjects (via metafieldsSet), I sometimes see errors such as:
    • “Field ‘metaobjects’ is missing required arguments: type”
    • “Cannot read properties of undefined (reading ‘productVariantUpdate’)”
  • Automatic Publishing: Additionally, even if metaobjects are created, they default to draft status, and I’d like them to be published (active) automatically without a manual update.

What I’ve Tried So Far:

  • I’ve attempted to use helper functions that look up metaobject GIDs based on normalized handles.
  • I’ve added caching to avoid redundant queries.
  • I tried using the metaobjectUpdate mutation to set the status to ACTIVE, but I run into issues where the input type for status isn’t recognized (e.g., “MetaobjectStatusEnum isn’t a defined input type” and “Field ‘status’ doesn’t exist on type ‘MetaobjectUpdateInput’”).
  • I also considered using REST endpoints for product creation, but I’d like to consolidate everything via GraphQL.

My Questions:

  1. What is the recommended way to update or set metaobjects as ACTIVE immediately upon creation via GraphQL? Is there a supported method for this, or must I use a workaround such as a scheduled background script?
  2. Regarding variant price updates, is there a preferred GraphQL mutation (like productUpdate) I should be using if productVariantUpdate isn’t available on my API version?
  3. Can I attach pre‑created metaobjects solely by using their normalized keys (or handles) without manually managing GIDs?
  4. Overall, is there any best practice or sample code available for a complete workflow (using GraphQL only) that creates a product and attaches several metaobject references automatically?

Any insights, updated documentation, or sample implementations would be greatly appreciated. I’m planning to handle tens of thousands of product uploads, so a robust solution is essential.

Thank you in advance for your help!