Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am trying to create a REST API based connection via PHP to create a product with multiple variations and multiple options but I cannot find a solution. I tried to run the code found in the documentation using the proposed shopify-php-api library but the PHP interpreter gives me the following error: "Parse error: syntax error, unexpected token "{", expecting "]"".
I also created a procedure with an associative array and the http_build_query function using curl for creating the API request. With this method I was able to handle a GET call of products and update an inventory of a specific variant but I am unable to create multi-variant and multi-option products.
Thank you in advance who will answer me!
Greetings
This is the code:
$prodotto= array();
$prodotto['product']['title']="TEST";
$prodotto['product']['variants'][0]['option1']="Nero";
$prodotto['product']['variants'][0]['option2']="35";
$prodotto['product']['variants'][1]['option1']="Blu";
$prodotto['product']['variants'][1]['option2']="36";
$prodotto['product']['options'][0]['name']="Colore";
$prodotto['product']['options'][0]['values'][0]="Nero";
$prodotto['product']['options'][0]['values'][1]="Blu";
$prodotto['product']['options'][1]['name']="Taglia";
$prodotto['product']['options'][1]['values'][0]="35";
$prodotto['product']['options'][1]['values'][1]="36";
Hi @IP1999, The question is still relevant. I have never been able to solve the problem.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025