Shopify Merge Fulfillment Location & Orders Response for Google Sheet
I am using the New Event module to send newly created orders from Shopify to Make.com through the use of a webhook.
New Event( Order Created) response is as follows:
{
"id": 5115840430332,
"data": {
"id": 5115840430332,
"admin_graphql_api_id": "gid://shopify/Order/5115840430332",
"app_id": 580111,
"browser_ip": "85.5.147.211",
"buyer_accepts_marketing": false,
"cancel_reason": null,
"cancelled_at": null,
"cart_token": null,
"checkout_id": ***,
"checkout_token": "***",
"client_details": {
"accept_language": "de-DE,de;q=0.9",
"browser_height": 661,
"browser_ip": "***.***.***.***",
"browser_width": 390,
"session_hash": null,
"user_agent": "***"
},
"closed_at": null,
"confirmed": true,
"contact_email": "***@hotmail.com",
"created_at": "2022-12-19T19:46:18+01:00",
"currency": "CHF",
"current_subtotal_price": "29.95",
"current_subtotal_price_set": {
"shop_money": {
"amount": "29.95",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "29.95",
"currency_code": "CHF"
}
},
"current_total_discounts": "0.00",
"current_total_discounts_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "CHF"
}
},
"current_total_duties_set": null,
"current_total_price": "36.85",
"current_total_price_set": {
"shop_money": {
"amount": "36.85",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "36.85",
"currency_code": "CHF"
}
},
"current_total_tax": "2.63",
"current_total_tax_set": {
"shop_money": {
"amount": "2.63",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "2.63",
"currency_code": "CHF"
}
},
"customer_locale": "de-CH",
"device_id": null,
"discount_codes": [],
"email": "***@hotmail.com",
"estimated_taxes": false,
"financial_status": "paid",
"fulfillment_status": null,
"gateway": "_twint",
"landing_site": "/recommendations/products?§ion_id=product-recommendations&product_id=7940944789756&limit=8",
"landing_site_ref": null,
"location_id": null,
"merchant_of_record_app_id": null,
"name": "#30678",
"note": null,
"note_attributes": [],
"number": 29678,
"order_number": 30678,
"order_status_url": "***",
"original_total_duties_set": null,
"payment_gateway_names": [
"***"
],
"phone": null,
"presentment_currency": "CHF",
"processed_at": "2022-12-19T19:46:17+01:00",
"processing_method": "offsite",
"reference": null,
"referring_site": "***",
"source_identifier": null,
"source_name": "web",
"source_url": null,
"subtotal_price": "29.95",
"subtotal_price_set": {
"shop_money": {
"amount": "29.95",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "29.95",
"currency_code": "CHF"
}
},
"tags": "SWP:CH",
"tax_lines": [
{
"price": "2.63",
"rate": 0.077,
"title": "MwSt",
"price_set": {
"shop_money": {
"amount": "2.63",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "2.63",
"currency_code": "CHF"
}
},
"channel_liable": false
}
],
"taxes_included": true,
"test": false,
"token": "fe5f5480f5347bf14a5087bc09700b96",
"total_discounts": "0.00",
"total_discounts_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "CHF"
}
},
"total_line_items_price": "29.95",
"total_line_items_price_set": {
"shop_money": {
"amount": "29.95",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "29.95",
"currency_code": "CHF"
}
},
"total_outstanding": "0.00",
"total_price": "36.85",
"total_price_set": {
"shop_money": {
"amount": "36.85",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "36.85",
"currency_code": "CHF"
}
},
"total_shipping_price_set": {
"shop_money": {
"amount": "6.90",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "6.90",
"currency_code": "CHF"
}
},
"total_tax": "2.63",
"total_tax_set": {
"shop_money": {
"amount": "2.63",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "2.63",
"currency_code": "CHF"
}
},
"total_tip_received": "0.00",
"total_weight": 0,
"updated_at": "2022-12-19T19:46:26+01:00",
"user_id": null,
"billing_address": {
"first_name": "***",
"address1": "*** 3",
"phone": "*** *** *** ***",
"city": "***",
"zip": "***",
"province": null,
"country": "***",
"last_name": "***",
"address2": "",
"company": null,
"latitude": 47.07407389999999,
"longitude": 7.3046369,
"name": "*** ***",
"country_code": "CH",
"province_code": null
},
"customer": {
"id": 6595610902780,
"email": "***@hotmail.com",
"accepts_marketing": false,
"created_at": "2022-12-19T19:43:13+01:00",
"updated_at": "2022-12-19T19:46:18+01:00",
"first_name": "Nadine",
"last_name": "Arnold",
"state": "disabled",
"note": null,
"verified_email": true,
"multipass_identifier": null,
"tax_exempt": false,
"tags": "",
"currency": "CHF",
"phone": null,
"accepts_marketing_updated_at": "2022-12-19T19:43:13+01:00",
"marketing_opt_in_level": null,
"tax_exemptions": [],
"email_marketing_consent": {
"state": "not_subscribed",
"opt_in_level": "single_opt_in",
"consent_updated_at": null
},
"sms_marketing_consent": null,
"admin_graphql_api_id": "gid://shopify/Customer/***",
"default_address": {
"id": 8082272059644,
"customer_id": 6595610902780,
"first_name": "***",
"last_name": "***",
"company": null,
"address1": "*** 3",
"address2": "",
"city": "Lyss",
"province": null,
"country": "***",
"zip": "***",
"phone": "*** *** *** ***",
"name": "*** ***",
"province_code": null,
"country_code": "***",
"country_name": "***",
"default": true
}
},
"discount_applications": [],
"fulfillments": [],
"line_items": [
{
"id": 12859015332092,
"admin_graphql_api_id": "gid://shopify/LineItem/12859015332092",
"fulfillable_quantity": 1,
"fulfillment_service": "manual",
"fulfillment_status": null,
"gift_card": false,
"grams": 0,
"name": "*** | *** *** *** - Beige / M",
"price": "29.95",
"price_set": {
"shop_money": {
"amount": "29.95",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "29.95",
"currency_code": "CHF"
}
},
"product_exists": true,
"product_id": 7940944789756,
"properties": [],
"quantity": 1,
"requires_shipping": true,
"sku": "10821",
"taxable": true,
"title": "*** | *** *** ***",
"total_discount": "0.00",
"total_discount_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "CHF"
}
},
"variant_id": 43972838457596,
"variant_inventory_management": null,
"variant_title": "Beige / M",
"vendor": "***",
"tax_lines": [
{
"channel_liable": false,
"price": "2.14",
"price_set": {
"shop_money": {
"amount": "2.14",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "2.14",
"currency_code": "CHF"
}
},
"rate": 0.077,
"title": "***"
}
],
"duties": [],
"discount_allocations": []
}
],
"payment_terms": null,
"refunds": [],
"shipping_address": {
"first_name": "Nadine",
"address1": "*** 3",
"phone": "079 *** ***",
"city": "***",
"zip": "***",
"province": null,
"country": "***",
"last_name": "***",
"address2": "",
"company": null,
"latitude": 47.***,
"longitude": 7.***,
"name": "*** ***",
"country_code": "***",
"province_code": null
},
"shipping_lines": [
{
"id": 4241716150524,
"carrier_identifier": null,
"code": "Standard",
"delivery_category": null,
"discounted_price": "6.90",
"discounted_price_set": {
"shop_money": {
"amount": "6.90",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "6.90",
"currency_code": "CHF"
}
},
"phone": null,
"price": "6.90",
"price_set": {
"shop_money": {
"amount": "6.90",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "6.90",
"currency_code": "CHF"
}
},
"requested_fulfillment_service_id": null,
"source": "shopify",
"title": "Standard",
"tax_lines": [
{
"channel_liable": false,
"price": "0.49",
"price_set": {
"shop_money": {
"amount": "0.49",
"currency_code": "CHF"
},
"presentment_money": {
"amount": "0.49",
"currency_code": "CHF"
}
},
"rate": 0.077,
"title": "MwSt"
}
],
"discount_allocations": []
}
]
},
"type": "orders/create",
"domain": "***.myshopify.com"
}
]
I am trying to add the assigned location where the products in the order will be fulfilled, but this information is not included in the response that Shopify sends. To do this, I am using the List Fulfillment Orders module and sending the Order ID that I received from New Event to this module. This allows me to retrieve the locations from which the products in the order will be fulfilled.
List Fulfillment Orders Response
[
{
"id": 6186136568060,
"shop_id": 7110754340,
"order_id": 5115840430332,
"assigned_location_id": 67370025212,
"request_status": "unsubmitted",
"status": "open",
"supported_actions": [
"create_fulfillment",
"hold"
],
"destination": {
"id": 5794993144060,
"address1": "*** 3",
"address2": "",
"city": "***",
"company": null,
"country": "***",
"email": "***@hotmail.com",
"first_name": "***",
"last_name": "***",
"phone": "*** *** *** ***",
"province": null,
"zip": "***"
},
"line_items": [
{
"id": 130921231231732436732,
"shop_id": 123123,
"fulfillment_order_id": 1212321,
"quantity": 1,
"line_item_id": 12859015432332092,
"inventory_item_id": 460623129720482044,
"fulfillable_quantity": 1,
"variant_id": 212412
}
],
"fulfill_at": "2022-12-19T18:00:00.000Z",
"fulfill_by": null,
"international_duties": null,
"fulfillment_holds": [],
"delivery_method": {
"id": 297090744572,
"method_type": "shipping",
"min_delivery_date_time": null,
"max_delivery_date_time": null
},
"assigned_location": {
"address1": "Address 1",
"address2": "",
"city": "City",
"country_code": "DE",
"location_id": 67370025212,
"name": "AD1 - Adresss Deppo",
"phone": "",
"province": null,
"zip": "***"
},
"merchant_requests": [],
"__IMTLENGTH__": 1,
"__IMTINDEX__": 1
}
]
I am using an Iterator to add each product in the order as a row in a Google Sheet. For products that are included in multiple orders, I am creating multiple rows.
However, in this part, if there are products in multiple locations in an order, I am adding too many rows to the Google Sheet because I have incorrectly configured it.
For example:
If there are 3 products in location X in 1 order, it transfers 3 records to the Google Sheet and there is no problem.
Let’s assume that there is 1 product in location X, 1 product in location Y, and 1 product in location Z in 1 order. In this case, it creates 9 records. It looks like this and it is incorrect:
Order →
Product → X Location
Product → Y Location
Product → Z Location
Product → X Location
Product → Y Location
Product → Z Location
Product → X Location
Product → Y Location
Product → Z Location
There should be 3 records created again. It needs to record which location each product has been assigned to.
Order →
Product → X Location
Product → Y Location
Product → Z Location
This is the desired output.