Attribute cart link to location and staff member

Hi,

we’ve implemented a POS UI extension that allows staff to quickly cancel and recreate orders when problems are identified after checkout is completed. During this process the extension calls the admin API to create a draft from the original order. Unfortunately, if the draft is emailed to the customer for checkout then the resultant order is not linked to the location or staff member that generated the draft. Is there any way to ensure the order is correctly attributed when processing these app-created cart links?

Thanks,

Paul

Use a custom attribute containing an app-generated UUID as a correlation ID.

When creating the draft order

Include this in DraftOrderInput: {
"customAttributes": [
{
"key": "yourapp_replacement_id",
"value": "b4c807fb-e746-4c36-9b0e-1c67afab4062"
}
]
}

When the order webhook arrives

Draft-order custom attributes transfer to the resulting order. In the orders/create webhook, look for the value in note_attributes :
{
“note_attributes”: [
{
“name”: “yourapp_replacement_id”,
“value”: “b4c807fb-e746-4c36-9b0e-1c67afab4062”
}
]
}

Use that UUID to find your database record and attach the new order ID.

So in short : with draft Order add an customAttribute then use webhook to check the note value and associate the staff member to the order.

Thanks for the quick response @Satish_Mantri. Much appreciated.

This approach would enable us to create the necessary attribution within services that consume the order webhooks. However, we also need to correct the order data within Shopify so that revenue is accurately reported and orders are visible to retail staff within the POS. Do you know if there’s a way to achieve this?

  1. Staff and location attribution for reporting
    Capture the originating POS staff and location IDs and link them to the replacement online order. Use this mapping in a custom report combining POS and online replacement sales. This does not change Shopify’s native POS attribution.

  2. Order visibility within POS
    Provide a custom interface in the POS app where authorized staff can view and track replacement online orders associated with their store or staff account. Access must follow merchant-approved permissions.

    For report generation for the staff related sales :

  3. Your report for staff related sales :

    Order source Attribution source
    Native POS order Shopify’s recorded retail location/staff
    Online replacement order Your custom location/staff mapping

Thats lot of implementation but presently this only looks like the only way out.

Following this one, as we’re building a POS app too and would love to know if there’s a supported way to set retail location and staff on orders created via the Admin API.