A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I can assign tags to customers using a code like below.
url="https://store.myshopify.com/admin/api/2022-01/customers/customer_id.json"
json={"customer":{"id":"customer_id","tags":"champion"}}
r = requests.put(url=url,json=json)
but I don't know what to do to remove a tag. I tried something like below, it seems to work but I'm not so sure.
url="https://store.myshopify.com/admin/api/2022-01/customers/customer_id.json"
json={"customer":{"id":"customer_id","tags":""}} #empty tags field
r = requests.put(url=url,json=json)
Solved! Go to the solution
This is an accepted solution.
Hey @evaness,
I took a closer look at this for you, and was initially able replicate with some testing. Updating customer tags with a similar request "tags": ""
- was returning an error.
Generally, using an empty value or an empty array []
in a PUT request would be the correct approach to removing tags with the REST API. This mirrors the functionality of tags on orders and products.
When testing again our results were successful, so I'm confident everything is working as expected. If you are getting errors or facing unexpected behaviors, please log x-request-id header values returned with the affected API response and share share - we can absolutely take a another look if needed - Cheers!
awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @evaness,
I took a closer look at this for you, and was initially able replicate with some testing. Updating customer tags with a similar request "tags": ""
- was returning an error.
Generally, using an empty value or an empty array []
in a PUT request would be the correct approach to removing tags with the REST API. This mirrors the functionality of tags on orders and products.
When testing again our results were successful, so I'm confident everything is working as expected. If you are getting errors or facing unexpected behaviors, please log x-request-id header values returned with the affected API response and share share - we can absolutely take a another look if needed - Cheers!
awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog