Flow Automation: Deleting Metafields via Action
In Flow Automation, you can use the Delete shop metafield action to automatically delete a specified metafield at a scheduled time or when specific conditions are met.
Metafields allow you to store additional custom information about resources, such as limited-time promotion details for products or customer service hours for your store. With this action, you can automatically delete metafields that are no longer needed when marketing campaigns end or business requirements change, preventing outdated information from being displayed and reducing manual cleanup.
This guide explains when to use this action, how to configure its field, compatible workflows, testing methods, and usage limitations, along with a practical workflow example.
| Note: For more information about metafields, refer to "Customizing Your Store Content with Metafields." |
When to Use the Delete Shop Metafield Action
You can use the Delete shop metafield action in the following scenarios:
- Removing expired campaign information: Automatically delete metafields that store temporary information, such as campaign announcements, after a limited-time marketing campaign ends to prevent outdated content from being displayed to customers.
- Scheduling the removal of temporary store information: Automatically delete metafields that are no longer needed at a specified time, eliminating the need for manual cleanup.
Field Descriptions
The Delete shop metafield action identifies the metafield to delete using its unique ID. You can enter the ID directly or click + Add variable to reference available data.
The following table describes the required field:
| Field | Description |
| The ID of the metafield (id) | The unique ID of the metafield to delete. Ensure that the ID matches the intended metafield. |
How to Find the Metafield ID
To find the metafield ID, follow these steps:
- From your SHOPLINE Admin, go to Settings > Customize data.
- Select the corresponding resource type and click the desired metafield to open its definition editing page.
- Check the URL in your browser's address bar. The number following /metafield/ is the metafield ID. For example, if the URL contains /metafield/12345678901/products/edit, the metafield ID is 12345678901.
- Copy the ID and enter it in The ID of the metafield of the action.
| Note: Before performing the deletion, verify that the ID corresponds to the intended metafield and resource type to avoid accidentally deleting other metafields. |
Applicable Workflows
The Delete shop metafield action is primarily used in workflows initiated by the following trigger:
- [General] Scheduled time
| Note: For detailed instructions on configuring the Scheduled time trigger, refer to "Flow Automation: Scheduled Trigger." |
Testing the Workflow
To verify that your workflow successfully deletes the specified metafield, follow these steps:
-
From your SHOPLINE Admin, go to Settings > Customize data, create a test metafield, and enter a test value.
Note: Deleted metafields cannot be restored. Use a metafield created specifically for testing to avoid affecting existing metafields. For detailed instructions on creating metafields, refer to "Customizing Your Store Content with Metafields." - In Flow Automation, create a workflow using the Scheduled time trigger and the Delete shop metafield action. Configure the following settings, then click Publish:
- Scheduled time: Set First trigger time to a few minutes from the current time and Repeat or not to Not repeating.
- Delete shop metafield: Enter the ID of the test metafield in The ID of the metafield field.
-
Once the scheduled trigger time has passed, return to Flow Automation to review the workflow execution results.
Note: For detailed instructions on checking workflow execution results, refer to the "How to View the Running of a Flow" section in the "Introduction to Flow Automation" guide. - From your SHOPLINE Admin, return to Settings > Customize data and verify that the test metafield has been deleted.
Example Use Case
The following example demonstrates how to use the Delete shop metafield action to automatically remove a campaign announcement after a limited-time marketing campaign ends.
Scenario: You use a metafield to store your Black Friday campaign announcement and display it in your online store's announcement bar through a dynamic source in your theme. The campaign ends at 9:00 AM on December 1, and you want to automatically delete the metafield at that time to prevent outdated campaign information from being displayed to customers.
Configure the workflow as follows:
-
Trigger: Scheduled time (starts the workflow at the specified time)
- First trigger time: 2026-12-01 09:00:00 (the campaign end time)
- Repeat or not: Not repeating
-
Action: Delete shop metafield
- The ID of the metafield: Enter the ID of the metafield that stores your Black Friday campaign announcement.
Result: When the campaign ends, the workflow automatically deletes the metafield that stores your Black Friday campaign announcement, eliminating the need for manual cleanup.
| Note: If the deleted metafield is used as a dynamic source in your theme, check your online store after deletion to ensure that the affected content displays as intended. |
Usage Limitations and Considerations
When using the Delete shop metafield action, keep the following rules and limitations in mind:
- Permanent deletion: Deleted metafields cannot be restored. Before publishing the workflow, ensure that the specified metafield is no longer needed.
- Metafield existence: The specified metafield must exist when the action is executed. If it has already been deleted, the action cannot complete the deletion.
- Avoiding repeated execution: A metafield only needs to be deleted once. To prevent repeated execution, set Repeat or not to Not repeating when using the Scheduled time trigger.