Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I'm trying to, using the Shopify Python library (which isn't that well documented), set a Metafield value that's currently a type single-line-text to either "" or Nil.
I've tried these solutions, and neither of them worked. My metafield definition will update to any other value I submit, but if I try submitting "" or None as the value, it will not change.
#Example code included. I removed parts that do not need to be altered, like creating the customer object etc.
def add_order_metafield(tag, value):
metafield = shopify.Metafield({
'key': tag,
'value': value,
'type':'single_line_text_field',
'namespace':'custom'
})
return metafield
#doesn't work
customer.add_metafield(add_order_metafield('date', ''))
#doesn't work
customer.add_metafield(add_order_metafield('date', None))
#works as intended
customer.add_metafield(add_order_metafield('date', "None"))
Any advice here would be helpful.