Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
Hi,
I'd really appreciate any help in my Shopify Flow
Main goal is: Upon customer account creation >>> update the customer default address company name based on the customer specific tag
1. Upon customer account creation.
2. Check if the he has a certain tags A,B,C, if so, then go to 3.
3. Then use that tag value to update the customer default address company name.
4. Quick twist: I don’t want the tag to include any additional tags that the customer has unless they match the first set of tags on (Step 2). E.g. if a customer has tags A and Apple, the condition will go through, but only tag A will be used to update the company name. Apple won’t be added as it doesn’t match the condition set in step#2.
Note: The customer will always has only one of those tags from Step 2 sit, so he won't have more than one. However, they might still have other tags not related to that sit.
Now, here's the hiccup, when I run the Shopify Flow, it seems the URL endpoint variable doesn't pick up the values of the customer ID and the address ID from the previous steps.
Thanks a bunch!
Cheers,
HTTP PUT Request:
https://XX.myshopify.com/admin/api/2024-01/customers/{{customer.id}}/addresses/{{customer.defaultAddress.id}}.json
Body:
{% assign numeric_customer_id = customer.id | remove: 'gid://shopify/Customer/' | split: '/' | last %}
{% assign numeric_customer_defaultAddress_id = customer.defaultAddress.id | remove: 'gid://shopify/MailingAddress/' | split: '/' | first %}
{% assign company_tag = '' %}
{% for tags_item in customer.tags %}
{% assign company_tag = tags_item %}
{% endfor %}
{% for addresses_item in customer.addresses %}
{% assign updated_company_value = company_tag %}
{% capture updated_company_json %}{"address": {"company": "{{ updated_company_value }}"}}{% endcapture %}
{{ updated_company_json }}
{% endfor %}
The error I got:
The request was unsuccessful
{"status":400,"response_body":"Bad Request","verb":"PUT","url":"https://XX.myshopify.com/admin/api/2024-01/customers/gid://shopify/Customer/6525273112612/addresses/gid://shopify/MailingAddress/7867024834596?model_name=CustomerAddress.json","request_body":"\n\n\n\n\n\n\n\n"}
Solved! Go to the solution
This is an accepted solution.
{{ customer.legacyResourceId }}
ID is a GID like "gid://shopify/Customer/123". You want legacyResourceId, which would be "123"
Hey Paul, I'm a bit stuck on how to make the variable grab the legacyResourceId value. Here's where I'm at:
https://XX.myshopify.com/admin/api/2024-01/customers/{{customer.id}}/addresses/{{customer.defaultAddress.id}}.json
{% assign numeric_customer_id = customer.id | remove: 'gid://shopify/Customer/' | split: '/' | last %}
{% assign numeric_customer_defaultAddress_id = customer.defaultAddress.id | remove: 'gid://shopify/MailingAddress/' | split: '/' | first %}
{% assign company_tag = '' %}
{% for tags_item in customer.tags %}
{% assign company_tag = tags_item %}
{% endfor %}
{% for addresses_item in customer.addresses %}
{% assign updated_company_value = company_tag %}
{% capture updated_company_json %}{"address": {"company": "{{ updated_company_value }}"}}{% endcapture %}
{{ updated_company_json }}
{% endfor %}
This is an accepted solution.
{{ customer.legacyResourceId }}
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025