Hi, I’m trying to use Flow to remove the text from a text field. Currently, I can add text to a metafield, but when I try to remove the text and leave the metafield empty, it doesn’t allow me to save the flow. Has anyone else come across this before?
Hey @Scott_Munn, moving this over to the Flow board
Hey @Scott_Munn , can you add a screenshot of your flow in here?
Hi @rishi_patel I want the in stock message to remove the text. However it throws an error when I save the flow.
You could write some liquid that would output an empty string. Like {% if false %}{%endif %}
Hi @paul_n, Sorry Im unsure what you mean. Would you be able to elaborate please?
The action requires you to input something. Liquid is something. I believe that if you add liquid that just outputs an empty string, it will remove the text in the metafield.
Hi @paul_n Thank you that did the job.
Hi @paul_n I have allowed the flow to run and the suggested approach has thrown an error.
Do you have any other suggestions?
As an alternative, you can use the standard Send HTTP request action or the Execute GraphQL request action from the Flow Companion app to send a request to the GraphQL API.
The request will look like this:
mutation MetafieldsDelete($metafields: [MetafieldIdentifierInput!]!) {
metafieldsDelete(metafields: $metafields) {
deletedMetafields {
key
namespace
ownerId
}
userErrors {
field
message
}
}
}
And the query variables will look like this:
{
"metafields": [{
"namespace": "custom",
"key": "some_key",
"ownerId": "{{productId}}"
}]
}
Hmm, sorry for the misdirect. Looks like this is an API limitation…you cannot blank metafields. I found an article suggesting 2 options: delete the metafield or use a placeholder value that represents blank. How to Save Empty Strings when using Shopify’s Metafields API | by Chris Geelhoed | Medium




