Create Flow for Shipping Calculation
- 15 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Create Flow for Shipping Calculation
- Updated on 15 Jun 2022
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
In order to create your own logic for calculating shipping costs for a specific set of products (shopping cart items) there is the ability to create a custom flow which. This custom flow has specific requirements from the OrderCentral side so that we can provide the flow with the product data and customer data for which the shipping costs should be generated.
- Create a flow
- Create three Apex-Defined variables
- Add the necessary logic to the flow and assign the outcome to the Result output variable
- Go to Setup -> Custom Metadata Types -> Delivery Methods
- Add a new- or adjust the existing Delivery Method and set the type to Flow
- Copy the flow name created in Step 1 and past it in the Flow Name field.
Variable name | Input/Output | Apex Type |
---|---|---|
products | Input | welisacommerce__OrderProduct (Allow multiple values (collection)) |
shippingAddress | Input | welisacommerce.Address |
Result | Output | welisacommerce.ShippingCalculationResult |
You can use the two input variables to base your calculation upon, they are not required if they will not be used. The Result output variable is required.
Type references
OrderProduct properties
Property Name | Type | Description |
---|---|---|
code | String | The Product2.ProductCode value |
quantity | Decimal | The number of ordered products |
Address properties
Property Name | Type |
---|---|
street | String |
city | String |
postalCode | String |
state | String |
country | String |
ShippingCalculationResult properties
Property Name | Type | Description |
---|---|---|
totalAmount | Decimal | The total shipping cost amount before tax |
deliveryTime | Integer | The expected delivery time in days. Zero or null will not be displayed in the ui |
label | String | If set it will override the configured label on the Delivery Method |