show all tracking_urls for an order containing more than 1 of the same item

show all tracking_urls for an order containing more than 1 of the same item

jonRreeves
Shopify Partner
1 0 0

Hi,

I'm working on a store which delivers products in the form of QR codes. The customer is able to purchase multiples of the same item, and each item in the order is fulfilled via an external service with a different tracking link (a link to a QR code)

The problem I am having, is it seems that if an order contains 2 of the same item, only 1 tracking_url is returned via order object. I feel I've tried every which way as per the documentation and similar posts on here. I'm sure this must be possible as the default customer orders page is able to show both of the tracking links in this scenario.

Example:

Customer purchases "Item 01" -> Order fulfilled with 2x "Item 01" -> 2 tracking urls given to the customer (visible on default customer orders page)

 

In liquid:

Iterate over customer.orders

Iterate over orders.line_items - at this point its worth noting that only 1 line item is present for the order

 

{{ line_item.quantity }} returns 2 
{{ line_item.fulfillment.tracking_url }} returns a single url

Iterating over line_item.fulfillment.fulfillment_line_items does not yield the desired result either.

This issue is not present if say the customer places an order with 1x "Item01" and 1x "Item02" - there is 2 tracking links available when stepping through relevant objects in customer.orders, which I assume is because they are now 2 individual line items, not a single line item with a quantity of 2?

Am I missing something or is this not achievable? 

Reply 1 (1)

gr_trading
Shopify Partner
2040 149 206

@jonRreeves 

 

You can write script on product page which will add a random number or text as property input which you can hide for user.

 

By doing this same product added into the cart will add a new item in cart.

 

Rest is working fine at your end.

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee