-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Is your feature request related to a problem? Please describe.
There are many shipping providers (e.g. shipstation, shippo, stamps.com, etc) which provide APIs which return an undetermined number of shipping methods with prices; currently in vendure a single Shipping Method can only return a single price, a single option.
Describe the solution you'd like
There should be some method for a "ShippingMethod" to return multiple options and some way when selecting shipping to set not only which ShippingMethod but which of the options it provided to use.
On discord (https://discord.com/channels/1100672177260478564/1200213503139655750/1200340563724083290) the suggestion was proposed to allow a shipping calculator to return multiple prices in an attempt to make it a non-breaking change.
Describe alternatives you've considered
Two options I've thought about:
-
Shipping plugin provides custom APIs for getting shipping methods, adds custom fields to the order for which is selected. The ShippingCalculator then looks at those fields to decide if it's going to be used.
-
The shipping calculator return the available shipping options as metadata; again custom fields can be used to set which method to use but if not provided it can return some arbitrary (or arbitrarily chosen?) value.
Both are a bit hacky, I feel like 2 is hackier than 1 =]
Additional context
Here is an abbreviated example of what the Shipstation APIs might return. (not exact, but it's what my custom API returns after getting all available carriers and services)
[
{
name: 'Stamps.com',
code: 'stamps_com',
nickname: 'USPS / Stamps',
shippingProviderId: 54321,
primary: true,
services: [
{
serviceName: 'USPS First Class Mail - Package',
serviceCode: 'usps_first_class_mail',
shipmentCost: 3.79,
otherCost: 0,
},
{
serviceName: 'USPS Priority Mail - Package',
serviceCode: 'usps_priority_mail',
shipmentCost: 6.64,
otherCost: 0,
},
],
},
{
name: 'UPS by ShipStation',
code: 'ups_walleted',
nickname: 'UPS',
shippingProviderId: 12345,
primary: true,
services: [
{
serviceName: 'UPS Next Day Air®',
serviceCode: 'ups_next_day_air',
shipmentCost: 17.76,
otherCost: 0,
},
{
serviceName: 'UPS® Ground',
serviceCode: 'ups_ground',
shipmentCost: 6.76,
otherCost: 0,
},
],
},
]Metadata
Metadata
Assignees
Labels
Type
Projects
Status