例如来自WooCommerce trigers woocommerce_add_to_cart hook的用户是否可以将产品数据作为json发送到Shopify应用程序,并通过Shopify应用程序接受该数据作为carts / create webhook?如果是这样我怎么能这样做?
更新:
终于找到了一种方法。这是和示例代码,用于添加顺序:
$ch = curl_init("https://api_key:api_pass@shop_name.myshopify.com/admin/orders.json");
$order = array('order' => array(
'line_items' => array(
array(
'title' => 'Big Brown Bear Boots',
'price' => '74.99',
'grams' => '1300',
'quantity' => 3,
),
array(
'title' => 'Clicky Keyboard',
'price' => '150',
'quantity' => 1,
)
)
));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($order));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
$this->response = curl_exec($ch);
你将这段代码挂钩到woocommerce行动。