Goal: Automate hiding a theme badge by clearing a product metafield (single-line text) via Shopify Flow.
Constraint: Shopify’s Metafields API requires a non-empty value; setting a blank value isn’t allowed (per metafieldsSet). Using a “reserved word” like “blank” would require theme logic to treat it as empty.
Workaround: Use Flow’s “Remove Product Metafield” action to delete the metafield so the theme sees it as null/absent. Note: This may only work if the metafield has no definition. Outcome: Implemented by the OP; looks promising and will be tested over time.
Follow-up topic: Writing metaobject references to a product metafield.
Issue: After creating metaobject entries with metaobjectUpsert, a user struggled to set a product metafield to those entries and tried Send Admin API and path-like values.
Guidance: Don’t use Send Admin API; use Flow’s “Update Product Metafield.” For a list.metaobject_reference metafield, set the value as an array of GIDs, e.g., [“gid://shopify/Metaobjects/123”,“gid://shopify/Metaobjects/345”].
Notes: Several screenshots of Flow UI and metaobject entries were shared. First issue appears resolved; second has actionable guidance but no confirmed success yet.
Summarized with AI on December 19.
AI used: gpt-5.
I am using a theme that generates custom badges when text is entered into a metafield (made of single-line text). When the metafield is empty, the custom badge will not display.
The only word that I would put in there is “preorder” but within Shopify Flow, I am unable to remove text in the VALUE field or leave it blank.
The metafields API doesn’t allow you to set blank values, so this isn’t possible. You might want to consider using another strategy, like a reserved word such as “blank”.
You might also be able to remove the metafield entirely instead and then check if it’s null.
You can try Flow’s “Remove Product Metafield” action. I think it will only work if the metafield doesn’t have a “definition”. This the API that Flow calls that show’s how to set a metafield and that the value field is required https://shopify.dev/docs/api/admin-graphql/2023-07/mutations/metafieldsSet
Regarding using something like “blank”, you would need to update your theme to account for that.
You don’t need to use the Send Admin API request to update a metafield. Just use “Update Product Metafield”. Assuming it accepts a list of metaobjects, it needs to look like [“gid://shopify/Metaobjects/123”,“gid://shopify/Metaobjects/345”].