Failed to process products/create: error is not defined

Failed to process products/create: error is not defined

ahmed_dev
Shopify Partner
2 0 0

Hello,

I'm creating an app where at some moment I need to add a product to the shop, I have used the graphql client, and passing these variables for the product creation.
It works fine and creates me a product when I do it like that

 

 

 

 

variables: {
          input: {
            title: `${data.title}`,
            variants: [{ price: randomPrice() }],
          },
        },

 

 

 

 

but when I try to add an image to the product, it gives me an error.

These are the variables I'm trying to post...

 

 

 

variables: {
          input: {
            title: `${data.title}`,
            "images": [
              {
                "width": 110,
                "height": 140,
                "src": data.imageUrl,
                "variant_ids": [
                  {}
                ]
              }
            ],
            variants: [{ price: randomPrice() }],
          },
        },

 

 

 


I'm doing it the right way or should I do something else in order to give the product an image url?

 

Replies 0 (0)