用程序化BigCommerce api创建订单时设置发货方式


Set shipping method while creating order programatically BigCommerce api

如何在使用BigCommerce api PHP库编程创建新订单的同时设置订单的运输方法:这是我用来创建订单的代码:

$createFields = array(
                      "customer_id"=>0,
                      "status_id"=> 1,
                      "date_created"=> $o_date,
                      "subtotal_ex_tax"=> strip_tags($xmlObj1->itemsTotal->asXML()),
                      "subtotal_inc_tax"=> floatval(strip_tags($xmlObj1->itemsTotal->asXML())) + floatval(strip_tags($xmlObj1->dutyTaxesTotal->asXML())),
                      "base_shipping_cost"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      "shipping_cost_ex_tax"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      "shipping_cost_inc_tax"=> strip_tags($xmlObj1->shippingTotal->asXML()),
                      //"base_handling_cost"=> 0,
                      //"handling_cost_ex_tax"=> 0,
                      //"handling_cost_inc_tax"=> 0,
                      //"base_wrapping_cost"=> 0,
                      //"wrapping_cost_ex_tax"=> 0,
                      //"wrapping_cost_inc_tax"=> 0,
                      "total_ex_tax"=> floatval(strip_tags($xmlObj1->grandTotal->asXML())) - floatval(strip_tags($xmlObj1->dutyTaxesTotal->asXML())),
                      "total_inc_tax"=> strip_tags($xmlObj1->grandTotal->asXML()),
                      //"refunded_amount"=> 0,
                      //"order_is_digital"=> false,
                      "staff_notes"=> strip_tags($xmlObj1->shippingCarrierServiceLevel->asXML()),
                      //"customer_message"=> "",
                      //"discount_amount"=> 10,
                      "billing_address"=> array(
                                            "first_name"=> $billing_name[0],
                                            "last_name"=> $billing_name[1],
                                            "company"=> strip_tags($xmlObj1->company->asXML()),
                                            "street_1"=> strip_tags($xmlObj1->billingAddress1->asXML()),
                                            "street_2"=> strip_tags($xmlObj1->billingAddress2->asXML()),
                                            "city"=> strip_tags($xmlObj1->billingCity->asXML()),
                                            "state"=> strip_tags($xmlObj1->billingState->asXML()),
                                            "zip"=> strip_tags($xmlObj1->billingZip->asXML()),
                                            "country"=> strip_tags($xmlObj1->billingCountryName->asXML()),
                                            "country_iso2"=> strip_tags($xmlObj1->billingCountryCode->asXML()),
                                            "phone"=> strip_tags($xmlObj1->billingPhone->asXML()),
                                            "email"=> strip_tags($xmlObj1->email->asXML())
                                          ),
                      "shipping_addresses"=> array(
                                                array(
                                                  "first_name"=> $name[0],
                                                  "last_name"=> $name[1],
                                                  "company"=> strip_tags($xmlObj1->company->asXML()),
                                                  "street_1"=> strip_tags($xmlObj1->address1->asXML()),
                                                  "street_2"=> strip_tags($xmlObj1->address2->asXML()),
                                                  "city"=> strip_tags($xmlObj1->city->asXML()),
                                                  "state"=> strip_tags($xmlObj1->state->asXML()),
                                                  "zip"=> strip_tags($xmlObj1->zip->asXML()),
                                                  "country"=> strip_tags($xmlObj1->countryName->asXML()),
                                                  "country_iso2"=> strip_tags($xmlObj1->countryCode->asXML()),
                                                  "phone"=> strip_tags($xmlObj1->phone->asXML()),
                                                  "email"=> strip_tags($xmlObj1->email->asXML())
                                                )
                                              ),
                      "products"=> $products,

                      "external_source"=> "iGlobal",
                    );
$bc_order_created = Bigcommerce::createOrder($createFields);

是否有一个字段将设置运输方法,或者我应该使用另一个api调用?

Shipping方法不是Orders资源的一部分属性。您希望将其作为装运的一部分进行分配。