laravel-shopify icon indicating copy to clipboard operation
laravel-shopify copied to clipboard

Undefined array key "product" when trying to create a product

Open DiarQoroviqi opened this issue 1 year ago • 1 comments

I am using the latest version of package, and when trying to create a product like its written in the documentation:

// Create a product
$product = $shopify->createProduct([
    'title' => 'Adidas Shoe, Pink',
]); // returns a ProductResource

it returns me an error: Undefined array key "product"?

DiarQoroviqi avatar Aug 09 '23 11:08 DiarQoroviqi

I am using the latest version of package, and when trying to create a product like its written in the documentation:

// Create a product
$product = $shopify->createProduct([
    'title' => 'Adidas Shoe, Pink',
]); // returns a ProductResource

it returns me an error: Undefined array key "product"?

It looks like you missing the detail from the official Shopify documentation. Since this package is mostly wrapper, the expected payload shall comply with the docs. Refer here https://shopify.dev/docs/api/admin-rest/2023-07/resources/product#post-products. It requires product key as the root index.

ikyandhi avatar Aug 16 '23 03:08 ikyandhi