(PHP - API REST) Problem With Multi-Variant And Multi-Option Product

Topic summary

A developer is struggling to create products with multiple variants and options using Shopify’s REST API via PHP.

Technical Issues:

  • Encountered a parse error (“unexpected token ‘{’”) when using the shopify-php-api library from documentation
  • Successfully implemented GET requests and inventory updates using curl with associative arrays and http_build_query
  • Unable to create multi-variant, multi-option products despite proper array structure

Code Approach:
The developer structured data with nested arrays defining:

  • Product title
  • Variants with option1/option2 values (e.g., color “Nero”/“Blu”, size “35”/“36”)
  • Options array specifying names (“Colore”, “Taglia”) and corresponding values

Current Status:
The issue remains unresolved. One commenter suggested verifying Shopify’s expected data format, but no concrete solution has been provided. The developer confirmed the problem persists with no successful workaround found.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

Hi @IP1999 , The question is still relevant. I have never been able to solve the problem.