Using Make.com/Zapier to remove metafield date field data

Hello!

We are a Shopify Revenue Optimization, Development, and Design agency, and we’ve been fighting with this particular request for a while. I’m hoping someone who has more automation experience than me can help out!

Problem: We’re using the ‘date’ metafield to show when a product is expected to return in stock on the PDP. It’s just a line of text on the PDP - if the metafield date is in the future, show the message; if it is non-existent, hide the message.

Goal: If the metafield date set is today, delete the data/remove the date, thus removing the message from the PDP. Ideally, this task just runs in Make once a day and deletes the date.

However, the client wants to completely delete the metafield data when the date has passed. To accomplish this, we tried using Make.com to run once a day that checks that metafield date, and if it is today or before, remove the metafield. But I cannot get it to work. I’ve attached the current state of the automation, but it’s been through quite a few tries.

Any help would be greatly appreciated! Thank you for reading!

Hi FifthEffect,

If I’m understanding this correctly, your goal is to automate the process of checking the ‘date’ metafield for each product and delete the metafield data if the date has passed. Here’s a simplified approach using the Shopify API, that you can implement in an automation tool or script:

  1. Fetch All Products with the ‘date’ Metafield:

First, you’ll need to fetch all products that have the ‘date’ metafield set:

GET /admin/api/2022-04/products.json?fields=id,metafields

This will return a list of products with their IDs and associated metafields.

  1. Filter Products Based on the ‘date’ Metafield:

Iterate through the list of products and filter out those that have the ‘date’ metafield set to a date in the past.

  1. Delete the Metafield for Filtered Products:

For each product that meets the criteria (i.e., the ‘date’ metafield is today or before), you’ll want to delete the metafield:

DELETE /admin/api/2022-04/products/{product_id}/metafields/{metafield_id}.json

You’ll want to replace {product_id} with the ID of the product and {metafield_id} with the ID of the ‘date’ metafield you want to delete.

  1. Automation:

You mentioned using Make.com for automation- ideally you should be able to set up a daily trigger in Make.com or any other automation tool you’re using, and use the tool’s actions or integrations to fetch products, filter based on the ‘date’ metafield, and delete the metafield as needed.

This approach should allow you to fetch products with the ‘date’ metafield, filter based on the date, and then delete the metafield for products that meet the criteria. Hope this helps,

Hey Liam,

Thanks so much for your detailed response! And my apologies that it took so long for a response, we had to try out your method!

After some attempts, we have noticed there are a few limitations with the Shopify API.

Firstly, we can’t send more than 4 requests per second. I addressed this by adding a 1 second delay between each request, but it significantly slows down the workflow.

Also, Shopify limits the product endpoint to 250 items per request. For stores with thousands of products like this store, we have to make multiple requests, each grabbing 250 products and processing them.

However, due to the 1-second delay between each request, this would complicate the workflow and make it take hours to complete.

Attached is a screenshot of the workflow, it currently pulls 500 products. Any suggestions are greatly appreciated @Liam !

Hey Liam! Thanks again for the information here!

I responded with additional questions below, and I would greatly appreciate your help!

Thanks so much! :folded_hands: