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.
Check Shopify's expected data format kind of like adjusting your pitch after Sales Training London to match the client's needs.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025