FieldsRaven developer docs
  • Welcome!
  • Quick Start
  • App embeds
    • Sitemap manager
    • Customer Birthday Popup
  • FAQ
  • Code examples
    • Create a single_line_text_field metafield
    • Delete a metafield
    • Create a product_reference metafield
    • Create a list.product_reference metafield
    • Create a json metafield
    • Create multiple metafields (aka flock)
  • Example features
    • Customer Birthday Popup (WIP)
    • Sitemap Manager (WIP)
    • Page SEO Editor (TBD)
    • Product FOMO (TBD)
    • Show off live traffic (TBD)
    • Collect custom customer attributes
    • Wish List
    • Customer registration with custom attributes
    • Customer Product Registration
  • Troubleshooting
  • Klaviyo
  • Airtable
Powered by GitBook
On this page
  1. Code examples

Delete a metafield

This won't delete the metafield definition, it will just clear metafield value

Use the same raven_id as the one used to create metafields, you don't need to create a new raven for the delete operation.

<!-- JavaScript + Liquid -->
<script type="text/javascript">
  fieldsRavenTestDelete = (value) => {
    const requestParams = {
      resource_id: {{ customer.id }},
      raven_id: 'TBD'
    };
    const response = fetch('/apps/raven/delete_metafield', {
      method: 'DELETE',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(requestParams)
    });

    response
      .then(res => res.json())
      .then(resJson => console.log('resJson: ', resJson));
  }
</script>

<!-- HTML -->
<button id="fieldsraven-demo" onclick="fieldsRavenTestDelete()">Delete metafield!</button>
PreviousCreate a single_line_text_field metafieldNextCreate a product_reference metafield

Last updated 10 months ago