使用Shopify Order API

时间:2017-03-16 09:53:40

标签: api shopify

我正在为Shopify商店制作私人申请。该应用程序应该取代标准的结帐流程。 一切运作良好,订单发送到我的Shopify商店,我可以在管理区域看到它,我面临的唯一问题是,在下订单后,购物车属性将不会重置(客户' s产品仍然存在于购物车中,最重要的是,购物车令牌不会改变)。 任何人都知道为什么会发生这种情况以及如何解决这个问题?我在想,也许我没有向商店发送足够的信息,但我可能错了。这就是我发送的内容:

$product = $shopify('POST /admin/orders.json', array(), array
    (
      'order' => array
      (
        "email" => $email,
        "fulfilment_status" => "",
        "send_receipt" => true,
        "line_items" => $products,
        'customer' => array
        (
          "first_name" => $firstName,
          "last_name" => $name,
          "email" => $email
        ),
        'billing_address' => array
        (
          "first_name" => $firstName,
          "last_name" => $name,
          "address1" => $adress,
          "phone" => $telefon,
          "city" => $city,
          "province" => $province,
          "country" => $country,
          "zip" => $zip
        ),
        'note_attributes' => array (
        array("name" => "Company", "value" => $company),
        array("name" => "CUI","value" => $cui),
        array("name" => "Registration","value" => $reg)
        ),
        'shipping_address' => array
        (
          "first_name" => $firstName,
          "last_name" => $name,
          "address1" => $adress,
          "phone" => $phone,
          "city" => $city,
          "province" => $province,
          "province_code" => $provinceCode,
          "name" => $firstName." ".$name,
          "country_code" => $countryCode,
          "country" => $country,
          "zip" => $zip
        ),
        'shipping_lines' => $shipping,
        'financial_status' => 'pending'
      )
    ));

1 个答案:

答案 0 :(得分:1)

执行inflating后,响应数据中会出现POST字段。将用户带到该URL,将重置购物车。

请注意,除非结帐流程完成订单,否则order_status_url将为空。

更正:通过API订购的订单无法进入结帐流程,在这种情况下请查看以下内容。

您可以order_status_urlAJAX GET清除购物车 您可以分别使用/cart/clear.jsAJAX POST /cart/update.js"attributes": {}清除属性/备注。