Shipping methods API overview
You can customize the shipping methods that are offered to customers at checkout using the shipping methods API.
The shipping methods API is part of the
Checkout domain. Scripts that use the shipping methods API run right before the customer reaches the shipping stage at checkout.
A script's signature is specific to the API that it uses. Every signature has single entry point that accepts input and returns output that is specific to the script API.
Shipping methods scripts accept input from the following:
Input: Contains order details from the current checkout stage, along with the list of store's shipping methods.
Configuration: The external configuration provided to a script.
Shipping method scripts return a single result that contains up to 3 parts. Each part independently dictates how the shipping methods are to be filtered, renamed, and reordered at checkout:
FilterResponse: Returns a list of shipping methods to hide.
RenameResponse: Returns the shipping methods to be renamed along with their new names.
SortResponse: Returns the shipping methods in the order in which they are to appear.
If a runtime error occurs in a script or if it times out, then the script run is treated as non-operative. Any results from the script are ignored and the default shipping methods are offered to customers.