productOptionsCreate mutation creates only 1 option value

Solved

productOptionsCreate mutation creates only 1 option value

jaadtoly
Shopify Partner
5 0 2

Hello ,

 

I'm a little bit stuck on this and I'll really appreciate your help.
I try to create an option with multiple values, using the mutation  productOptionsCreate.
Whatever I do, it only creates one option (the first one : Yellow). When I check the specs, values is indeed an array.
https://shopify.dev/docs/api/admin-graphql/latest/mutations/productoptionscreate 

 

Your help will be greatly appreciated. 😀

 

mutation AddOptions {
  productOptionsCreate(
    options: {name: "myColors", values:   [
        {
          name: "Yellow"
        },
        {
          name: "Red"
        }
    ]},
    productId: "gid://shopify/Product/14843488108876"
  ) {
    product {
      options {
        id
        name
        values
      }
    }

 

Thanks a lot !

Accepted Solution (1)
Aima
Shopify Partner
2 1 1

This is an accepted solution.

Yes, ProductSet mutation is working, Thank you

View solution in original post

Replies 7 (7)
jaadtoly
Shopify Partner
5 0 2

Thanks a lot for your very fast reply ! I tried this on GraphiQL and I think it's not working because values expects an OptionValueCreateInput datatype.
Did you tried that by yourself on GraphiQL. Thx again :-).

Capture d’écran 2025-04-21 165656.png

jaadtoly
Shopify Partner
5 0 2

And there is an exemple of multiple name (for value), here https://shopify.dev/docs/api/admin-graphql/latest/mutations/productoptionupdate.
Apparently it's not working with the create 🙂

Easify-Jolie
Shopify Partner
282 9 26

Hi @jaadtoly 

If you’re open to trying an app instead of working with the code, you can check out Easify Product Options. It lets you create product options with multiple values easily—no coding needed. Might save you some time. Here's an example of a product that has a lot of options:

  • This is the result: 

EasifyJolie_6-1745308788109.png

 

EasifyJolie_7-1745308803857.png

 

EasifyJolie_8-1745308811605.png

 

  • This is the app setting:

EasifyJolie_9-1745308857898.png

 

EasifyJolie_10-1745308864619.png

 

This app is easy to use, and I highly recommend giving it a try. If you need any help, feel free to ask or contact Easify!

Easify Product Options: Any product options app can help you create custom options, but Easify turns those options into sales and conversions!
Easify Inventory Sync: Automate inventory syncing for Bundles, Duplicates, and Raw Materials. Say goodbye to manual tracking headaches.
Easify Product Attachments: Enrich your store with downloadable content. Easily add PDFs and other files to product or any page.
>>> Try Apps for Free | 24/7 Live Chat Support
jaadtoly
Shopify Partner
5 0 2

Thanks a lot for the info, but that's not applicable in my case, as I develop a full nodejs app. I'll try with productOptionUpdate (optionValuesToAdd). Apparently there is a bug with productOptionsCreate.

 

Have a lovely day

Aima
Shopify Partner
2 1 1

Can you help me with the same issue?

I am developing an app that creates products using mutations in Shopify. I have successfully created the product creation and media creation APIs, but I am currently encountering errors while creating the variants.

When I attempt to create variants, I receive an error saying "no options exist." And, when I try to add options before creating variants, it only generates the first option.

jaadtoly
Shopify Partner
5 0 2

Hi Aima,

 

I didn't tried yet, but my next try will be a call to the mutation ProductSet. Apparently with that mutation, you can create the product, images, variants, options, etc.. in 1 (asynchronous) call. No need to call one mutation for the product, one for the variant, one for the options, etc... Give it a try and tell me if it works.  😀

 

 

 

Aima
Shopify Partner
2 1 1

This is an accepted solution.

Yes, ProductSet mutation is working, Thank you