Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi, I'm trying to create products and I'm trying to run createProducts and then productVariantsBulkCreate, but I get these errors:
Error processing product group: GraphqlQueryError: Variable $variants of type [ProductVariantsBulkInput!]! was provided invalid value for 0.sku (Field is not defined on ProductVariantsBulkInput), 0.inventoryQuantities.0.locationId (Expected value to not be null)
I'm also getting these below:
errors: { 22:06:44 │ remix │ networkStatusCode: 200, 22:06:44 │ remix │ message: "GraphQL Client: An error occurred while fetching from the API. Review 'graphQLErrors' for details.", 22:06:44 │ remix │ graphQLErrors: [Array], 22:06:44 │ remix │ response: Response { 22:06:44 │ remix │ status: 200, 22:06:44 │ remix │ statusText: 'OK', 22:06:44 │ remix │ headers: Headers { 22:06:44 │ remix │ date: 'Sun, 09 Feb 2025 21:06:45 GMT', 22:06:44 │ remix │ 'content-type': 'application/json; charset=utf-8', 22:06:44 │ remix │ 'transfer-encoding': 'chunked', 22:06:44 │ remix │ connection: 'keep-alive', 22:06:44 │ remix │ 'x-sorting-hat-podid': '380', 22:06:44 │ remix │ 'x-sorting-hat-shopid': '89820430717', 22:06:44 │ remix │ vary: 'Accept-Encoding', 22:06:44 │ remix │ 'referrer-policy': 'origin-when-cross-origin', 22:06:44 │ remix │ 'x-frame-options': 'DENY', 22:06:44 │ remix │ 'x-shopid': '89820430717', 22:06:44 │ remix │ 'x-shardid': '380', 22:06:44 │ remix │ 'x-stats-userid': '', 22:06:44 │ remix │ 'x-stats-apiclientid': '209777721345', 22:06:44 │ remix │ 'x-stats-apipermissionid': '813438763389', 22:06:44 │ remix │ 'x-shopify-api-version': '2024-10', 22:06:44 │ remix │ 'content-language': 'en', 22:06:44 │ remix │ 'strict-transport-security': 'max-age=7889238', 22:06:44 │ remix │ 'x-request-id': '101763a6-1912-489f-91fe-c4890fca60b9-1739135204', 22:06:44 │ remix │ 'server-timing': 'processing;dur=36, graphql;desc="admin/mutation/other", cfRequestDuration;dur=95.999956', 22:06:44 │ remix │ 'content-security-policy': "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net 22:06:44 │ remix │ https://checkout.pci.shopifyinc.com https://checkout.pci.shopifyinc.com/build/5ae8bbe/card_fields.js https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&s ource%5Bsection%5D=admin_api&source%5Buuid%5D=101763a6-1912-489f-91fe-c4890fca60b9-1739135204; report-to shopify-csp", 22:06:44 │ remix │ 'x-content-type-options': 'nosniff', 22:06:44 │ remix │ 'x-download-options': 'noopen', 22:06:44 │ remix │ 'x-permitted-cross-domain-policies': 'none', 22:06:44 │ remix │ 'x-xss-protection': '1; mode=block', 22:06:44 │ remix │ 'reporting-endpoints': 'shopify-csp="/csp-report?source%5Baction%5D =query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&s ource%5Buuid%5D=101763a6-1912-489f-91fe-c4890fca60b9-1739135204"', 22:06:44 │ remix │ 'x-dc': 'gcp-europe-west3,gcp-europe-west4,gcp-europe-west4', 22:06:44 │ remix │ 'content-encoding': 'gzip', 22:06:44 │ remix │ 'alt-svc': 'h3=":443"; ma=86400', 22:06:44 │ remix │ 'cf-cache-status': 'DYNAMIC', 22:06:44 │ remix │ 'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=d5tJ5xifgYb7YyMDz5HP%2BBJUlkC fmPfOQ%2BOXlub0IVB%2FnCdaEnKAtFZTyyQD%2FAOj2vrQWOZpgrEoHybedAKxj1M2pKbSiCW4DVZXCougMryID7OuNUJe2dswqR CfcUF9hCVHBNbdBPODH%2BaQl84OGTQhUyBe"}],"group":"cf-nel","max_age":604800}', 22:06:44 │ remix │ nel: '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}', 22:06:44 │ remix │ server: 'cloudflare', 22:06:44 │ remix │ 'cf-ray': '90f6d336aafff781-MAD' 22:06:44 │ remix │ },
I'm not entirely sure what I'm doing wrong. Can anyone point me in the right direction? This is the code I'm using:
const PRODUCT_CREATE_MUTATION = ` mutation productCreate($input: ProductInput!) { productCreate(input: $input) { product { id title } userErrors { field message } } } `; const VARIANT_UPDATE_MUTATION = ` mutation productVariantsBulkCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { userErrors { field message } product { id options { id name values position } } productVariants { id title selectedOptions { name value } } } } `;
Can anyone point me in the right direction? Thank you very much!
I also have this issue so hopefully you can find the answer you want for your problem
Hi @jlista
It looks like in the VARIANT_UPDATE_MUTATION variable, productVariants is missing some attributes that your payload is sending. Please review your payload and add those fields (e.g., sku, inventoryQuantities, etc.). Follow Shopify's guidelines here: https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/productVariantsBulkCreate
B2Bridge: All-in-one B2B wholesale solution, enabling merchants to set up a complete B2B store quickly and without coding.
With features like customizable registration forms, customer segmentation, and tailored price lists, it simplifies wholesale management.
B2Bridge also includes a dedicated Quick Order page and flexible Net Payment Terms, streamlining operations for wholesalers and enhancing the buying experience.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025