A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi, I try to create a php file to insert product to shopify, I try to use 2023-4 but I receive a error
Parse error: syntax error, unexpected token "{", expecting "]" in /var/www/vhosts/mysite/Shopify/verify.php on line 24
$response = $client->post(
"products",
[
"product" => [
"title" => "Giacca Uomo 2 Bottoni",
"body_html" => "<strong>Giacca Uomo 2 Bottoni</strong>",
"vendor" => "7Concept",
"product_type" => "Abiti",
"variants" => [{"option1"=>"58", "price"=>"199.00", "sku"=>"123"},{"option1"=>"56", "price"=>"199.00", "sku"=>"124"}],
],
]
);
the problem is to:
"variants" => [{"option1"=>"58", "price"=>"199.00", "sku"=>"123"},{"option1"=>"56", "price"=>"199.00", "sku"=>"124"}],
],
not acept "[" why?
Solved! Go to the solution
This is an accepted solution.
Resolved... I need replace { with [
from
"variants" => [{"option1"=>"58", "price"=>"199.00", "sku"=>"123"},{"option1"=>"56", "price"=>"199.00", "sku"=>"124"}],
to
"variants" => [["option1"=>"58", "price"=>"199.00", "sku"=>"123"],["option1"=>"56", "price"=>"199.00", "sku"=>"124"]],
This is an accepted solution.
Resolved... I need replace { with [
from
"variants" => [{"option1"=>"58", "price"=>"199.00", "sku"=>"123"},{"option1"=>"56", "price"=>"199.00", "sku"=>"124"}],
to
"variants" => [["option1"=>"58", "price"=>"199.00", "sku"=>"123"],["option1"=>"56", "price"=>"199.00", "sku"=>"124"]],