Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Create New Product

Create New Product

edwinlaksono
Shopify Partner
1 0 1

Hello,

i try to create a new product with a fetch call. I am using php to add a new product.

But i get this error: 

{"errors":{"product":"Required parameter missing or invalid"}}

Reply 1 (1)

lizk
Shopify Staff
246 58 79

Hi there 👋

 

From that error message is seems like you are missing one of the required parameters. Would you be able to share your code you are using to make the API request?

In the developer documentation you should find code sample for creating products with the Shopify API in PHP. 

use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation {
    productCreate(input: {title: "Sweet new product", productType: "Snowboard", vendor: "JadedPixel"}) {
      product {
        id
      }
    }
  }
QUERY;

$response = $client->query(["query" => $query]);



To learn more visit the Shopify Help Center or the Community Blog.