How custom shipping method works
0. App installed
Merchant will need to install your app in order for your shipping rules and settings to be shown.
1. Rates configuration
After the installation, user would need a page where they can configure it: provide their account details, set up dimensions, etc.
We recommend using Native apps feature to provide this functionality. To manage and store those settings, see the Merchant settings for shipping method section.
2. Shipping request
To show new shipping methods in storefront, Ecwid will send a POST request to your endpoint with order details: items that require shipping and have shipping set as global or global + fixed rate per item, customer address, merchant app settings, etc. That endpoint must respond to the request with the shipping rates for this configuration.
The request to your app URL can also be triggered by a customer in storefront or by an API request to Calculate order details
In the case of an API request for calculating order details, products and cart information itself can be different from what the store has. For example, some other application can create a custom storefront where it requests order calculation with items that are not present in the store.
For these cases, your application should also provide correct discount calculations for the amount of cart information available.
3. Rates returned
Ecwid will expect a response from your service within 10 second interval to display additional shipping methods for customers. In the response, provide shipping method name, rate and estimated delivery time. See the response format in the Shipping request and response
4. Rates shown to customer
Based on the response from your app, Ecwid will display the shipping methods for customers at the checkout. Customer can select them just like any other shipping method in that Ecwid store and it will be shown in the order details.
Shipping methods from the application will be added to any currently enabled shipping methods a store has enabled.
Custom shipping FAQ
Q: What happens if my URL responds with an error?
In case if your app responds with an error or in an incorrect format, then the shipping methods from your app will not be shown to customer at checkout stage.
When your store has other applicable shipping methods set up, then they will be shown to customer.
Q: Does Ecwid cache the requests in any way?
Yes. Ecwid will not make a request to your URL if both these conditions are met:
- previous request happened less than 5 minutes ago
- request details are exactly the same as in previous request
In other cases, Ecwid will make a new request to your endpoint. For example, a new product was added to cart, shipping/payment method was changed, customer address was changed, etc.
Any event that changes the order details will reset the cache and Ecwid will make a new request to your endpoint.