Quantcast
Viewing all articles
Browse latest Browse all 11091

Array{"errors":{"line_items":"expected Hash to be a Array"}} by Thomas1234no

Hi,

I'm developing my first Shopify App, and I'm using PHP. 

I've successfully got data from my shop to display in my app, but I struggle with creating an order through my app. 

The problem is line_items, because I get this error message all the times: 
Array{"errors":{"line_items":"expected Hash to be a Array"}}

I have tried to make line_items an array of arrays, like shown in my code sample below, but still the same error. 

What can I do? I will really appreciate any help as fast as possible. :) 

 

$query = array(
	"Content-type" => "application/json", // Tell Shopify that we're expecting a response in JSON format
	"order" => array(
		"line_items" => array(
			array(
				"sku" => "100",
				"quantity" => "1"
			)
		),
		"customer" => array(
			"email" => "firmapost@bitk.no"
		), 
		"financial_status" => "pending"
	)
);
// Run API call to get all products
$orders = shopify_call($token, $shop, "/admin/orders.json", $query, 'POST');

 


Viewing all articles
Browse latest Browse all 11091

Trending Articles