運送設定

shippingsettings 資源可讓您擷取及更新多重客戶帳戶 (MCA) 和所有相關聯子帳戶的運送設定。

MCA 通常由管理多個商家網路商店和 API 服務的整合商、集結網站和管道合作夥伴使用。如果商家經營多個網路商店或品牌,並透過個別網站販售,也可以選擇在單一 MCA 之下建立子帳戶。

Google 可以自動更新某些產品的預估送達時間。詳情請參閱「啟用自動改善功能」。

shippingsettings.list

如果處理 MCA 帳戶,shippingsettings.list 呼叫會傳回帳戶或所有子帳戶的所有運送資源資訊。

shippingsettings.list 方法的網址範例:

GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/shippingsettings

以下是 JSON 回應範例,顯示 MCA 帳戶的 11112222 子帳戶運送設定:

{
 "kind": "content#shippingsettingsListResponse",
 "resources": [
  {
   "accountId": "1111",
   "services": [
    {
     "name": "Standard Shipping",
     "active": true,
     "deliveryCountry": "US",
     "currency": "USD",
     "deliveryTime": {
      "minHandlingTimeInDays": 0,
      "maxHandlingTimeInDays": 1,
      "transitTimeTable": {
       "postalCodeGroupNames": [
        "Region1",
        "Region2",
        "all other locations"
       ],
       "transitTimeLabels": [
        "all other labels"
       ],
       "rows": [
        {
         "values": [
          {
           "minTransitTimeInDays": 1,
           "maxTransitTimeInDays": 2
          }
         ]
        },
        {
         "values": [
          {
           "minTransitTimeInDays": 2,
           "maxTransitTimeInDays": 3
          }
         ]
        },
        {
         "values": [
          {
           "minTransitTimeInDays": 3,
           "maxTransitTimeInDays": 5
          }
         ]
        }
       ]
      }
     },
     "rateGroups": [
      {
       "singleValue": {
        "flatRate": {
         "value": "0",
         "currency": "USD"
        }
       },
       "name": "Standard Shipping"
      }
     ],
     "eligibility": "All scenarios"
    },
    {
     "name": "Expedited",
     "active": true,
     "deliveryCountry": "US",
     "currency": "USD",
     "deliveryTime": {
      "minTransitTimeInDays": 2,
      "maxTransitTimeInDays": 2,
      "minHandlingTimeInDays": 0,
      "maxHandlingTimeInDays": 1
     },
     "rateGroups": [
      {
       "singleValue": {
        "flatRate": {
         "value": "9.99",
         "currency": "USD"
        }
       },
       "name": "Expedited"
      }
     ],
     "eligibility": "All scenarios"
    }
   ],
   "postalCodeGroups": [
    {
     "name": "Region1",
     "country": "US",
     "postalCodeRanges": [
      {
       "postalCodeRangeBegin": "94035",
       "postalCodeRangeEnd": "94070"
      }
     ]
    },
    {
     "name": "Region2",
     "country": "US",
     "postalCodeRanges": [
      {
       "postalCodeRangeBegin": "94071",
       "postalCodeRangeEnd": "94082"
      }
     ]
    }
   ]
  },
  {
   "accountId": "2222",
   "services": [
    {
     "name": "FedEx",
     "active": true,
     "deliveryCountry": "US",
     "currency": "USD",
     "deliveryTime": {
      "minTransitTimeInDays": 4,
      "maxTransitTimeInDays": 6,
      "minHandlingTimeInDays": 0,
      "maxHandlingTimeInDays": 0
     },
     "rateGroups": [
      {
       "singleValue": {
        "flatRate": {
         "value": "5.99",
         "currency": "USD"
        }
       },
       "name": "All products"
      }
     ],
     "eligibility": "All scenarios except Shopping Actions"
    },
    {
     "name": "GSA Shipping - Free Ship Over $49.99",
     "active": true,
     "deliveryCountry": "US",
     "currency": "USD",
     "deliveryTime": {
      "minTransitTimeInDays": 3,
      "maxTransitTimeInDays": 7,
      "minHandlingTimeInDays": 1,
      "maxHandlingTimeInDays": 2
     },
     "rateGroups": [
      {
       "mainTable": {
        "rowHeaders": {
         "prices": [
          {
           "value": "49.99",
           "currency": "USD"
          },
          {
           "value": "infinity",
           "currency": "USD"
          }
         ]
        },
        "rows": [
         {
          "cells": [
           {
            "flatRate": {
             "value": "6.99",
             "currency": "USD"
            }
           }
          ]
         },
         {
          "cells": [
           {
            "flatRate": {
             "value": "0",
             "currency": "USD"
            }
           }
          ]
         }
        ]
       },
       "name": "Free Ship Over $49.99"
      }
     ],
     "eligibility": "Shopping Actions"
    }
   ]
  }
 ]
}

shippingsettings.get

透過 shippingsettings.get 呼叫,MCA 帳戶可以取得單一子帳戶的運送設定資訊,或取得獨立帳戶來取得自己的帳戶狀態資訊。

使用下列呼叫取得運送設定資訊,其中 merchantId 是 MCA 帳號,accountId 是子帳戶。如果 Merchant Center 帳戶並非多重客戶帳戶,shippingsettings.get 仍可傳回運送設定資訊。在這種情況下,請為 merchantIdaccountId 參數使用相同的 Merchant Center 帳號。

GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/shippingsettings/accountId

以下是子帳戶的 JSON 回應範例,並透過用於 list 呼叫的 MCA 帳戶,設定了 StandardExpedited 運送服務:

{
 "accountId": "1111",
 "services": [
  {
   "name": "Standard Shipping",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minHandlingTimeInDays": 0,
    "maxHandlingTimeInDays": 1,
    "transitTimeTable": {
     "postalCodeGroupNames": [
      "Region1",
      "Region2",
      "all other locations"
     ],
     "transitTimeLabels": [
      "all other labels"
     ],
     "rows": [
      {
       "values": [
        {
         "minTransitTimeInDays": 1,
         "maxTransitTimeInDays": 2
        }
       ]
      },
      {
       "values": [
        {
         "minTransitTimeInDays": 2,
         "maxTransitTimeInDays": 3
        }
       ]
      },
      {
       "values": [
        {
         "minTransitTimeInDays": 3,
         "maxTransitTimeInDays": 5
        }
       ]
      }
     ]
    }
   },
   "rateGroups": [
    {
     "singleValue": {
      "flatRate": {
       "value": "0",
       "currency": "USD"
      }
     },
     "name": "Standard Shipping"
    }
   ],
   "eligibility": "All scenarios"
  },
  {
   "name": "Expedited",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minTransitTimeInDays": 2,
    "maxTransitTimeInDays": 2,
    "minHandlingTimeInDays": 0,
    "maxHandlingTimeInDays": 1
   },
   "rateGroups": [
    {
     "singleValue": {
      "flatRate": {
       "value": "9.99",
       "currency": "USD"
      }
     },
     "name": "Expedited"
    }
   ],
   "eligibility": "All scenarios"
  }
 ],
 "postalCodeGroups": [
  {
   "name": "Region1",
   "country": "US",
   "postalCodeRanges": [
    {
     "postalCodeRangeBegin": "94035",
     "postalCodeRangeEnd": "94070"
    }
   ]
  },
  {
   "name": "Region2",
   "country": "US",
   "postalCodeRanges": [
    {
     "postalCodeRangeBegin": "94071",
     "postalCodeRangeEnd": "94082"
    }
   ]
  }
 ]
}

shippingsettings.update

shippingsettings.update 呼叫可讓 MCA 帳戶更新單一子帳戶或獨立帳戶的運送設定資訊。

PUT https://shoppingcontent.googleapis.com/content/v2.1/merchantId/shippingsettings/accountId

以下是 JSON 要求主體範例,用於將運送服務 (帳戶 ID 為 10 中,帳戶 ID 2222) 的maxTransitTimeInDays更新為 7GSA Shipping - Free Ship Over $49.99

{
...
    "services": [
      {
        "name": "FedEx",
        "active": true,
        "deliveryCountry": "US",
        "currency": "USD",
        "deliveryTime": {
          "minTransitTimeInDays": 4,
          "maxTransitTimeInDays": 6,
          "minHandlingTimeInDays": 0,
          "maxHandlingTimeInDays": 0
        },
        "rateGroups": [
          {
            "singleValue": {
              "flatRate": {
                "value": "5.99",
                "currency": "USD"
              }
            },
            "name": "All products"
          }
        ],
        "eligibility": "All scenarios except Shopping Actions"
      },
      {
        "name": "GSA Shipping - Free Ship Over $49.99",
        "active": true,
        "deliveryCountry": "US",
        "currency": "USD",
        "deliveryTime": {
          "minTransitTimeInDays": 3,
          "maxTransitTimeInDays": 7,
          "minHandlingTimeInDays": 1,
          "maxHandlingTimeInDays": 2
        },
        "rateGroups": [
          {
            "mainTable": {
              "rowHeaders": {
                "prices": [
                  {
                    "value": "49.99",
                    "currency": "USD"
                  },
                  {
                    "value": "infinity",
                    "currency": "USD"
                  }
                ]
              },
              "rows": [
                {
                  "cells": [
                    {
                      "flatRate": {
                        "value": "6.99",
                        "currency": "USD"
                      }
                    }
                  ]
                },
                {
                  "cells": [
                    {
                      "flatRate": {
                        "value": "0",
                        "currency": "USD"
                      }
                    }
                  ]
                }
              ]
            },
            "name": "Free Ship Over $49.99"
          }
        ],
        "eligibility": "Shopping Actions"
      }
    ]
  }
}

以下是 JSON 回應主體範例:

{
 "accountId": "2222",
 "services": [
  {
   "name": "FedEx",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minTransitTimeInDays": 4,
    "maxTransitTimeInDays": 6,
    "minHandlingTimeInDays": 0,
    "maxHandlingTimeInDays": 0
   },
   "rateGroups": [
    {
     "singleValue": {
      "flatRate": {
       "value": "5.99",
       "currency": "USD"
      }
     },
     "name": "All products"
    }
   ],
   "eligibility": "All scenarios except Shopping Actions"
  },
  {
   "name": "GSA Shipping - Free Ship Over $49.99",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minTransitTimeInDays": 3,
    "maxTransitTimeInDays": 7,
    "minHandlingTimeInDays": 1,
    "maxHandlingTimeInDays": 2
   },
   "rateGroups": [
    {
     "mainTable": {
      "rowHeaders": {
       "prices": [
        {
         "value": "49.99",
         "currency": "USD"
        },
        {
         "value": "infinity",
         "currency": "USD"
        }
       ]
      },
      "rows": [
       {
        "cells": [
         {
          "flatRate": {
           "value": "6.99",
           "currency": "USD"
          }
         }
        ]
       },
       {
        "cells": [
         {
          "flatRate": {
           "value": "0",
           "currency": "USD"
          }
         }
        ]
       }
      ]
     },
     "name": "Free Ship Over $49.99"
    }
   ],
   "eligibility": "Shopping Actions"
  }
 ]
}

shippingsettings.custombatch

shippingsettings.custombatch 呼叫會擷取或更新多重客戶帳戶中多個子帳戶的運送設定資訊。

JSON 要求包含 MCA 帳號的 merchantId、子帳戶的 accountId、專屬 batchId 以及 method 設為 getmethod,可用於擷取運送設定,而 update 則用於修改運送設定。

POST https://shoppingcontent.googleapis.com/content/v2.1/shippingsettings/batch

下列範例 JSON 要求主體包含兩個部分:

  1. 用來擷取帳戶 ID 1111 運送設定的 batchId=1
  2. batchId=2,用於將運送服務 GSA Shipping - Free Ship Over $49.99maxTransitTimeInDays 更新為 8。(針對前一個 shippingsettings.update 回應主體範例中顯示的帳戶 ID 2222,這項設定已從 7 變更為其他設定)。
{
  "entries": [
    {
      "accountId": 1111,
      "merchantId": 10,
      "method": "get",
      "batchId": 1
    },
    {
      "accountId": 2222,
      "merchantId": 10,
      "method": "update",
      "batchId": 2,
      "shippingSettings": {
        "services": [
          {
            "name": "FedEx",
            "active": true,
            "deliveryCountry": "US",
            "currency": "USD",
            "deliveryTime": {
              "minTransitTimeInDays": 4,
              "maxTransitTimeInDays": 5,
              "minHandlingTimeInDays": 0,
              "maxHandlingTimeInDays": 0
            },
            "rateGroups": [
              {
                "singleValue": {
                  "flatRate": {
                    "value": "5.99",
                    "currency": "USD"
                  }
                },
                "name": "All products"
              }
            ],
            "eligibility": "All scenarios except Shopping Actions"
          },
          {
            "name": "GSA Shipping - Free Ship Over $49.99",
            "active": true,
            "deliveryCountry": "US",
            "currency": "USD",
            "deliveryTime": {
              "minTransitTimeInDays": 3,
              "maxTransitTimeInDays": 8,
              "minHandlingTimeInDays": 1,
              "maxHandlingTimeInDays": 2
            },
            "rateGroups": [
              {
                "mainTable": {
                  "rowHeaders": {
                    "prices": [
                      {
                        "value": "49.99",
                        "currency": "USD"
                      },
                      {
                        "value": "infinity",
                        "currency": "USD"
                      }
                    ]
                  },
                  "rows": [
                    {
                      "cells": [
                        {
                          "flatRate": {
                            "value": "6.99",
                            "currency": "USD"
                          }
                        }
                      ]
                    },
                    {
                      "cells": [
                        {
                          "flatRate": {
                            "value": "0",
                            "currency": "USD"
                          }
                        }
                      ]
                    }
                  ]
                },
                "name": "Free Ship Over $49.99"
              }
            ],
            "eligibility": "Shopping Actions"
          }
        ]
      }
    }
  ]
}

以下是 JSON 回應主體範例:

{
 "kind": "content#shippingsettingsCustomBatchResponse",
 "entries": [
  {
   "kind": "content#shippingsettingsCustomBatchResponseEntry",
   "batchId": 1,
   "shippingSettings": {
    "accountId": "1111",
    "services": [
     {
      "name": "Standard Shipping",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
       "minHandlingTimeInDays": 0,
       "maxHandlingTimeInDays": 1,
       "transitTimeTable": {
        "postalCodeGroupNames": [
         "Region1",
         "Region2",
         "all other locations"
        ],
        "transitTimeLabels": [
         "all other labels"
        ],
        "rows": [
         {
          "values": [
           {
            "minTransitTimeInDays": 1,
            "maxTransitTimeInDays": 2
           }
          ]
         },
         {
          "values": [
           {
            "minTransitTimeInDays": 2,
            "maxTransitTimeInDays": 3
           }
          ]
         },
         {
          "values": [
           {
            "minTransitTimeInDays": 3,
            "maxTransitTimeInDays": 5
           }
          ]
         }
        ]
       }
      },
      "rateGroups": [
       {
        "singleValue": {
         "flatRate": {
          "value": "0",
          "currency": "USD"
         }
        },
        "name": "Standard Shipping"
       }
      ],
      "eligibility": "All scenarios"
     },
     {
      "name": "Expedited",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
       "minTransitTimeInDays": 2,
       "maxTransitTimeInDays": 2,
       "minHandlingTimeInDays": 0,
       "maxHandlingTimeInDays": 1
      },
      "rateGroups": [
       {
        "singleValue": {
         "flatRate": {
          "value": "9.99",
          "currency": "USD"
         }
        },
        "name": "Expedited"
       }
      ],
      "eligibility": "All scenarios"
     }
    ],
    "postalCodeGroups": [
     {
      "name": "Region1",
      "country": "US",
      "postalCodeRanges": [
       {
        "postalCodeRangeBegin": "94035",
        "postalCodeRangeEnd": "94070"
       }
      ]
     },
     {
      "name": "Region2",
      "country": "US",
      "postalCodeRanges": [
       {
        "postalCodeRangeBegin": "94071",
        "postalCodeRangeEnd": "94082"
       }
      ]
     }
    ]
   }
  },
  {
   "kind": "content#shippingsettingsCustomBatchResponseEntry",
   "batchId": 2,
   "shippingSettings": {
    "accountId": "2222",
    "services": [
     {
      "name": "FedEx",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
       "minTransitTimeInDays": 4,
       "maxTransitTimeInDays": 5,
       "minHandlingTimeInDays": 0,
       "maxHandlingTimeInDays": 0
      },
      "rateGroups": [
       {
        "singleValue": {
         "flatRate": {
          "value": "5.99",
          "currency": "USD"
         }
        },
        "name": "All products"
       }
      ],
      "eligibility": "All scenarios except Shopping Actions"
     },
     {
      "name": "GSA Shipping - Free Ship Over $49.99",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
       "minTransitTimeInDays": 3,
       "maxTransitTimeInDays": 8,
       "minHandlingTimeInDays": 1,
       "maxHandlingTimeInDays": 2
      },
      "rateGroups": [
       {
        "mainTable": {
         "rowHeaders": {
          "prices": [
           {
            "value": "49.99",
            "currency": "USD"
           },
           {
            "value": "infinity",
            "currency": "USD"
           }
          ]
         },
         "rows": [
          {
           "cells": [
            {
             "flatRate": {
              "value": "6.99",
              "currency": "USD"
             }
            }
           ]
          },
          {
           "cells": [
            {
             "flatRate": {
              "value": "0",
              "currency": "USD"
             }
            }
           ]
          }
         ]
        },
        "name": "Free Ship Over $49.99"
       }
      ],
      "eligibility": "Shopping Actions"
     }
    ]
   }
  }
 ]
}

shippingsettings.getsupportedcarriers

透過 shippingsettings.getsupportedcarriers 呼叫,MCA 帳戶或獨立帳戶可取得支援的電信業者。

GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/supportedCarriers

以下是 JSON 回應主體範例:

{
 "kind": "content#shippingsettingsGetSupportedCarriersResponse",
 "carriers": [
  {
   "name": "FedEx",
   "country": "US",
   "services": [
    "Ground",
    "Home Delivery",
    "Express Saver",
    "First Overnight",
    "Priority Overnight",
    "Standard Overnight",
    "2Day"
   ]
  },
  {
   "name": "UPS",
   "country": "US",
   "services": [
    "2nd Day Air",
    "2nd Day Air AM",
    "3 Day Select",
    "Ground",
    "Next Day Air",
    "Next Day Air Early AM",
    "Next Day Air Saver"
   ]
  },
  {
   "name": "USPS",
   "country": "US",
   "services": [
    "Priority Mail Express",
    "Media Mail",
    "Retail Ground",
    "Priority Mail",
    "First Class Package Service Retail",
    "First Class Package Service Commercial Base"
   ]
  },
  {
   "name": "Australia Post",
   "country": "AU",
   "services": [
    "Regular Parcel",
    "Express Post"
   ]
  },
  {
   "name": "TNT",
   "country": "AU",
   "services": [
    "Road Express",
    "Overnight Express"
   ]
  },
  {
   "name": "TOLL",
   "country": "AU",
   "services": [
    "Road Delivery",
    "Overnight Priority"
   ]
  },
  {
   "name": "DHL",
   "country": "DE",
   "services": [
    "Paket",
    "Päckchen"
   ]
  },
  {
   "name": "DPD",
   "country": "DE",
   "services": [
    "Express 12",
    "Express",
    "Classic Parcel"
   ]
  },
  {
   "name": "Hermes",
   "country": "DE",
   "services": [
    "Päckchen",
    "Paketklasse S",
    "Paketklasse M",
    "Paketklasse L"
   ]
  },
  {
   "name": "UPS",
   "country": "DE",
   "services": [
    "Express",
    "Express Saver",
    "Standard"
   ]
  },
  {
   "name": "DHL UK",
   "country": "GB",
   "services": [
    "Express",
    "Express 12"
   ]
  },
  {
   "name": "DPD UK",
   "country": "GB",
   "services": [
    "Express 12",
    "Express Next Day",
    "Standard Parcel 12",
    "Standard Parcel Next Day",
    "Standard Parcel Two Day"
   ]
  },
  {
   "name": "RMG",
   "country": "GB",
   "services": [
    "1st Class Small Parcel",
    "1st Class Medium Parcel",
    "2nd Class Small Parcel",
    "2nd Class Medium Parcel"
   ]
  },
  {
   "name": "TNT UK",
   "country": "GB",
   "services": [
    "Express",
    "Express 10",
    "Express 12"
   ]
  },
  {
   "name": "UPS UK",
   "country": "GB",
   "services": [
    "Express",
    "Express Saver",
    "Standard"
   ]
  },
  {
   "name": "Yodel",
   "country": "GB",
   "services": [
    "B2C 48HR",
    "B2C 72HR",
    "B2C Packet"
   ]
  }
 ]
}

shippingsettings.getsupportedholidays

shippingsettings.getsupportedholidays 呼叫可讓 MCA 帳戶或獨立帳戶擷取支援的節日。

GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/supportedHolidays

以下是 JSON 回應範例:

{
 "kind": "content#shippingsettingsGetSupportedHolidaysResponse",
 "holidays": [
  {
   "id": "FR_Christmas_2019-12-25",
   "countryCode": "FR",
   "type": "Christmas",
   "date": "2019-12-25",
   "deliveryGuaranteeDate": "2019-12-24",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Easter_2019-04-21",
   "countryCode": "US",
   "type": "Easter",
   "date": "2019-04-21",
   "deliveryGuaranteeDate": "2019-04-20",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Mother's Day_2019-05-12",
   "countryCode": "US",
   "type": "Mother's Day",
   "date": "2019-05-12",
   "deliveryGuaranteeDate": "2019-05-11",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Father's Day_2019-06-16",
   "countryCode": "US",
   "type": "Father's Day",
   "date": "2019-06-16",
   "deliveryGuaranteeDate": "2019-06-15",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Independence Day (USA)_2019-07-04",
   "countryCode": "US",
   "type": "Independence Day (USA)",
   "date": "2019-07-04",
   "deliveryGuaranteeDate": "2019-07-03",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Halloween_2019-10-31",
   "countryCode": "US",
   "type": "Halloween",
   "date": "2019-10-31",
   "deliveryGuaranteeDate": "2019-10-30",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Thanksgiving_2019-11-28",
   "countryCode": "US",
   "type": "Thanksgiving",
   "date": "2019-11-28",
   "deliveryGuaranteeDate": "2019-11-27",
   "deliveryGuaranteeHour": "18"
  },
  {
   "id": "US_Christmas_2019-12-25",
   "countryCode": "US",
   "type": "Christmas",
   "date": "2019-12-25",
   "deliveryGuaranteeDate": "2019-12-24",
   "deliveryGuaranteeHour": "18"
  }
 ]
}

設定郵遞區號群組

雖然在 Merchant Center 中建立區域很方便,但只要利用 Content API 來維護多個區域經常變動的帳戶即可。

您可以利用運送設定服務來設定、取得及更新運送設定和區域。在 API 中,區域稱為 postalCodeGroups

"postalCodeGroups": [
  {
    "name": "string,
    "country": string,
    "postalCodeRanges": [
      {
        "postalCodeRangeBegin": string,
        "postalCodeRangeEnd": string
      }
    ]
  }
]

與 UI 一樣,postalCodeGroups 是簡單的郵遞區號範圍、郵遞區號範圍、郵遞區號首碼或前置字串範圍。

系統會擷取區域並搭配運送設定來設定,因此只有透過現有的運送設定資源填寫 postalCodeGroups 才會刪除運送服務。

透過 API 設定區域的正確方式如下:

  1. 發出 get 呼叫即可擷取所有運送服務和 postalCodeGroups (區域)。
  2. get 呼叫中的運送服務複製到 update 呼叫。
  3. 如果未在運送服務中使用運送時間標籤,請將下列項目從要求主體中移除:

    "transitTimeLabels": [
        "all other labels"
    ],
    
  4. 填入 update 呼叫的 postalCodeGroups 區段中的區域。

  5. 同時填入運送服務和 postalCodeGroups 區段的 update 呼叫。

以下是上方使用的第一個 get 範例的 update 呼叫要求主體範例,其中區域 1 的 postalCodeGroups 已從 94035 更新為 94036

{
  "services": [
    {
      "name": "Standard Shipping",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
        "minHandlingTimeInDays": 0,
        "maxHandlingTimeInDays": 1,
        "transitTimeTable": {
          "postalCodeGroupNames": [
            "Region1",
            "Region2",
            "all other locations"
          ],
          "rows": [
            {
              "values": [
                {
                  "minTransitTimeInDays": 1,
                  "maxTransitTimeInDays": 2
                }
              ]
            },
            {
              "values": [
                {
                  "minTransitTimeInDays": 2,
                  "maxTransitTimeInDays": 3
                }
              ]
            },
            {
              "values": [
                {
                  "minTransitTimeInDays": 3,
                  "maxTransitTimeInDays": 5
                }
              ]
            }
          ]
        }
      },
      "rateGroups": [
        {
          "singleValue": {
            "flatRate": {
              "value": "0",
              "currency": "USD"
            }
          },
          "name": "Standard Shipping"
        }
      ],
      "eligibility": "All scenarios"
    },
    {
      "name": "Expedited",
      "active": true,
      "deliveryCountry": "US",
      "currency": "USD",
      "deliveryTime": {
        "minTransitTimeInDays": 2,
        "maxTransitTimeInDays": 2,
        "minHandlingTimeInDays": 0,
        "maxHandlingTimeInDays": 1
      },
      "rateGroups": [
        {
          "singleValue": {
            "flatRate": {
              "value": "9.99",
              "currency": "USD"
            }
          },
          "name": "Expedited"
        }
      ],
      "eligibility": "All scenarios"
    }
  ],
  "postalCodeGroups": [
    {
      "name": "Region1",
      "country": "US",
      "postalCodeRanges": [
        {
          "postalCodeRangeBegin": "94036",
          "postalCodeRangeEnd": "94070"
        }
      ]
    },
    {
      "name": "Region2",
      "country": "US",
      "postalCodeRanges": [
        {
          "postalCodeRangeBegin": "94071",
          "postalCodeRangeEnd": "94082"
        }
      ]
    }
  ]
}

以下是 JSON 回應範例:

{
 "accountId": "1111",
 "services": [
  {
   "name": "Standard Shipping",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minHandlingTimeInDays": 0,
    "maxHandlingTimeInDays": 1,
    "transitTimeTable": {
     "postalCodeGroupNames": [
      "Region1",
      "Region2",
      "all other locations"
     ],
     "rows": [
      {
       "values": [
        {
         "minTransitTimeInDays": 1,
         "maxTransitTimeInDays": 2
        }
       ]
      },
      {
       "values": [
        {
         "minTransitTimeInDays": 2,
         "maxTransitTimeInDays": 3
        }
       ]
      },
      {
       "values": [
        {
         "minTransitTimeInDays": 3,
         "maxTransitTimeInDays": 5
        }
       ]
      }
     ]
    }
   },
   "rateGroups": [
    {
     "singleValue": {
      "flatRate": {
       "value": "0",
       "currency": "USD"
      }
     },
     "name": "Standard Shipping"
    }
   ],
   "eligibility": "All scenarios"
  },
  {
   "name": "Expedited",
   "active": true,
   "deliveryCountry": "US",
   "currency": "USD",
   "deliveryTime": {
    "minTransitTimeInDays": 2,
    "maxTransitTimeInDays": 2,
    "minHandlingTimeInDays": 0,
    "maxHandlingTimeInDays": 1
   },
   "rateGroups": [
    {
     "singleValue": {
      "flatRate": {
       "value": "9.99",
       "currency": "USD"
      }
     },
     "name": "Expedited"
    }
   ],
   "eligibility": "All scenarios"
  }
 ],
 "postalCodeGroups": [
  {
   "name": "Region1",
   "country": "US",
   "postalCodeRanges": [
    {
     "postalCodeRangeBegin": "94036",
     "postalCodeRangeEnd": "94070"
    }
   ]
  },
  {
   "name": "Region2",
   "country": "US",
   "postalCodeRanges": [
    {
     "postalCodeRangeBegin": "94071",
     "postalCodeRangeEnd": "94082"
    }
   ]
  }
 ]
}

使用取貨/取貨地點

如要進一步瞭解取貨/取貨地點訂單,包括與宅配到府訂單的差別,以及需要處理哪些取貨專屬資訊,請參閱取貨/取貨地點指南。

當天到貨服務

如果您有本地商品目錄,可以使用 Content API for Shopping 設定當天到貨運送服務。

當天到貨運送服務的local_deliveryshipmentType相同。目前將所有 local_delivery 項運送服務視為當天出貨。您無法針對本地配送服務變更「deliveryTime」資訊。

你可以使用 shippingsettings.update 為店面商品目錄產品設定當天到貨服務。

下方的要求主體範例會將當天到貨服務加入帳戶中所有商店:

請先更新下列範例中的所有值,再用於實作。

{
   "accountId":"accountId",
   "services":[
      {
         "name": "Local Delivery",
         "active":true,
         "shipmentType":"local_delivery",
         "deliveryCountry":"US",
         "currency":"USD",
         "rateGroups":[
            {
               "singleValue":{
                  "flatRate":{
                     "value":"0",
                     "currency":"USD"
                  }
               }
            }
         ],
         "eligibility":"All scenarios",
         "storeConfig":{
            "storeServiceType":"all stores",
            "storeCodes":[
               
            ],
            "cutoffConfig":{
               "storeCloseOffsetHours":2,
               "no_delivery_post_cutoff":true
            },
            "serviceRadius":{
               "value":4,
               "unit":"Miles"
            }
         }
      }
   ]
}

次日到貨服務

根據預設,凡是在當天到貨截止時間過後才下單的訂單,會按次日送達。如要關閉次日到貨功能,請將 no_delivery_post_cutoff 設為 true。如果停用次日到貨服務,運送服務只會在每天的截止時間之前顯示。

只有在shipmentTypelocal_delivery時,才能享有次日到貨服務。

測試

由於所有項目都處於實際工作環境中,因此請避免變更上線項目的任何重要項目,尤其是使用 update() 方法,因為這是唯一會變更現有值的值。