Remove item from list of strings

I am trying to remove three terms (that represent old values) from a list of Shopify Customer tags, and add the latest value back into the list of customer tags. What I have results in the desired value just being appended to the tags list, without removing any of the old values.

{{remove(13.tags; " Membership Active"; " Membership Cancelled"; " Membership Complete")}} with the “Map” option checked, and adding the latest value separately.

image

I have also tried

{{add(remove(13.tags; "Membership Active"; "Membership Cancelled"; "Membership Complete"); " Membership " + 9.properties.membership_status)}}

But Shopify throws the error:

Tags must be unique and can’t differ only by special characters: [“‘Membership Active’”, “Membership Active”].

Thanks!

Hi. Are you trying remove a tag using the field to add an tag? The function “remove” is internal for Make to remove values from arrays not a endpoint resource in the APIs.

Don’t hesitate to contact us if you require further assistance.

Cheers
//HFBR

1 Like

Hi - this field will accept an array of strings, and it was my understanding was that “remove” returned an array. How can I take an array input, mutate it, and output it again?

What module are you doing to remove the tags?

If you need additional support, please don’t hesitate to reach out.

Cheers
//HFBR

I am using an action to update a Shopify customer

@ruarri It seems like your variable “Tags” is not actually an array. The remove() functions works with arrays, so you need to make sure you either transform the tags to an array or something.
Can’t see much with the screenshots you’ve given.

1 Like

Thanks @Bjorn.drivn. Hopefully this screenshot provides the necessary context. The contact is just sample data populated by Hubspot.

I did see in the docs that Tags must be a string of comma separated values on input. I’m still getting the same result though, where I’m only appending the new value.

Hi @ruarri ,

It’s hard to debug it on our end :wink: I recommend you start debugging and testing with a “Set Variable” module so you can see what it actually outputs eventually. Most likely something is going wrong somewhere with a data type, or a function.
Once you figured out the output is not what the API is expecting, you can move it over to the Shopify module again.

1 Like

Thanks @Bjorn.drivn - It’s hard to debug on my end! I am new to Make, so I’m not quite sure what tools are available or handy for debugging. I’ll try what you suggested.

1 Like

Hi, did it work out with this?

Looks like the issue is because Shopify already have a similar tag which you are trying to map from the second tag field. However the existing tag is slightly different by case or something,

1 Like

Yes! IIRC, ultimately it came down to inconsistent whitespace before and/or after my values I was looking to remove.

For example, in my use, I did not see or pay attention to whitespace between my values and the separating “;”

image