Focusing on managing products, variants, and collections through the API.
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"}}
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.