Use Custom Logic for Shipping Calculation
- 05 Sep 2022
- 1 Minute to read
- Print
- DarkLight
Use Custom Logic for Shipping Calculation
- Updated on 05 Sep 2022
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
When our standard shipping cost calculation options do not fulfill the needs there is the option to use flow for defining custom logic.
First create a new flow. In that flow two Apex-Defined variables available for input are required.
- Products (type welisacommerce__OrderProduct)
- shippingAddress (type welisacommerce__Address)
Finally one Apex-Defined variable vailable for output is required
- Result (type welisacommerce_ShippingCostCalculationResult)
The result type (welisacommerce__ShippingCostCalculationResult) has the following properties:
- deliveryTime (Integer) - amount of days for expected delivery. If not set no expected delivery time will be displayed
- label (String) - If set the default label on the Delivery_Method__mdt will be overriden, if not set the default will be displayed
- totalAmount (Decimal) - total amount (without tax) applied as shipping cost
After saving and activating the flow copy the (technical) name of the flow and past it in the Flow Name field on the delivery method.