How to Get the Selected Shipping Method of Item in the Order

How to Get the Selected Shipping Method of Item in the Order

mpeterson39
Shopify Partner
2 0 1

Hi Shopify community,

 

I need help with my Flow automation that sends order emails to suppliers.

Currently, when an order is placed, my Flow checks for supplier metafields and sends order details to the appropriate suppliers. I recently added code to show shipping methods in these emails:

 

 

Selected Shipping Methods:<br> 
{% for shipping_line in order.shippingLines %} 
- {{ shipping_line.title }} <br> 
{% endfor %}

 

 

The problem is this displays ALL shipping methods to EVERY supplier. For example, if an order has two products from different suppliers (X and Y), both suppliers see both shipping methods in their emails, which is confusing.

Is there a way to show only the relevant shipping method for each supplier's products? Can I associate specific shipping methods with specific products in the order?

 

We're using product metafields to identify suppliers and have recently updated our shipping profiles with a checkout customization function.

 

Any suggestions would be appreciated!

Reply 1 (1)

paul_n
Shopify Staff
1672 183 382

You might be able to use order / fulfillmentOrders or order / fulfillments instead. If you use either, just know that they are not available when an order is created. Fulfillment orders are populated after ~ 5s. You can add a "wait" step after the trigger to give them time to show up. Look at the "deliveryMethod" fields on the fulfillment order to see if anything there helps. 

 

Order / Fulfillments timing depend on when fulfillment starts happening. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.