致命错误:未捕获的GuzzleHttp \ Exception \ ClientException:客户端错误:PUT http://magento.localhost.com/rest/V1/carts/4/order
导致400 Bad Request
响应:{“ message”:“请指定一种运送方式。”}
我的代码:
$shipBill = '{
"addressInformation": {
"shipping_address": {
"id": 60,
"customer_id": 1,
"region": "Arkansas",
"region_id": 5,
"country_id": "US",
"street": [
"Whitefield,New York"
],
"company": "IBM",
"telephone": "94354545",
"postcode": "234533",
"city": "New York",
"firstname": "test",
"lastname": "test",
"prefix": "address_",
"region_code": "AR"
},
"billing_address": {
"id": 60,
"customer_id": 1,
"region": "Arkansas",
"region_id": 5,
"country_id": "US",
"street": ["Whitefield,New York"],
"company": "IBM",
"telephone": "94354545",
"postcode": "234533",
"city": "New York",
"firstname": "test",
"lastname": "test",
"prefix": "address_",
"region_code": "AR"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}';
$checkout = $magento->createShippingAndBilling($quoteId, $shipBill)->getInArray();
$payment = '
{
"paymentMethod": {
"method": "checkmo"
}
}';
$order = $magento->orderCreate($quoteId, $payment)->getInArray();
我已通过其余API在购物车中添加了商品。只有当我尝试下订单时,一切都正常了。