Send email when metafield is set to true and inventory levels greater than 0

nicoleatet
Visitor
1 0 0

We are using the app Metafields Guru to edit our metafields. We have a boolean metafield called "is_hidden", which hides variants from our web store when set to true. This is super useful, but it becomes a bit tricky to track what is hidden and what is not after a while. I am reaching out to see if it's possible to configure a Shopify Flow that triggers when "is_hidden" is set to true for that variant and inventory levels increase over 0, to then send an email alert. Or, if even possible, to send that product variant to a google spreadsheet.

Replies 3 (3)

PaulNewton
Shopify Partner
6274 572 1311

Hi @nicoleatet You should just be able to use the following task modified to check the variant metafield

Get notified by email when product variant inventory is low

https://shopify.com/admin/apps/flow/web/editor/templates/6078af13-af76-49e5-aeda-c9c1ee11eea1 

 

Flow should also be able to change the metafield value unless it's read-only from the app.

 

For sheets keep in mind sending rows is one way, so it can't delete rows when the conditions.

So you have to remove rows as soon as they are irrelevant.

 

Another approach for products with few variants is adding/removing the product to a collection thought still implies digging.

 

If you need more advanced automations usemechanic can fill the gaps flow can't handle and more with custom scripts.

Examples in the library: 

https://tasks.mechanic.dev/?q=variant%20metafield 

 

 

If you need this automation developed then contact me by email for services.
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

 

Good Hunting.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


Ablestar_Daniel
Shopify Partner
80 10 16

I think a flow like the following should be able to do what you need:

 

Screenshot 2023-12-29 at 8.55.14 AM.png

Each time the inventory is updated the email will be sent if all the following are true:

  • The variant's inventory is > 0
  • The variant has a metafield custom.is_hidden set to 'true'

The forums won't let me attach a .flow file but I've included an export of the job in the next message. You should be able to import this to your store and configure it.

 

A few things you'll need to check after you import it:

  • Make sure the namespace of the metafield is correct (if it's not 'custom')
  • Change the email address to an internal one for your team 

One other thing is that our Ablestar Bulk Product Editor might also be a good way to manage these. You could quickly search for variants that have is_hidden=true and inventory:

 

Screenshot 2023-12-29 at 9.04.03 AM.png

 

Once you've identified the products you could either:

 

  • Do a bulk edit in the app to set is_hidden = false
  • Export a CSV file of the products so you can check them manually
  • Create a recurring export that would generate this CSV file daily

I hope the Flow export works for you and happy to answer any other questions you might have.

 

Best,

Daniel

 

 

Founder @ Ablestar ✦
Manage product data, spreadsheets, Google Shopping data, and metafields with Ablestar Bulk Product Editor. Use previews, undos, and automations to be confident your product data is correct.
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Ablestar_Daniel
Shopify Partner
80 10 16

Here's the export for the flow file. If you copy everything below here into a file named something like 'is_hidden.flow' you should be able to import it into Shopify Flow:

 

2c83832283c08f7d866da7712654b2f9ced475addc100885162512eeea9dc8b9:{"__metadata":{"version":0.1},"root":{"steps":[{"step_id":"74ff21b0-a63c-11ee-9ec8-37818f38ecb6","step_position":[900,1120],"config_field_values":[],"task_id":"shopify::admin::inventory_quantity_changed","task_version":"0.1","task_type":"TRIGGER","description":null,"note":null,"name":null},{"step_id":"78a175c0-a63c-11ee-9ec8-37818f38ecb6","step_position":[1260,1120],"config_field_values":[{"config_field_id":"condition","value":"{\"uuid\":\"4270d212-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"cd5607c0-a63c-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270d212-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"cd5607c1-a63c-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cd5607c0-a63c-11ee-9ec8-37818f38ecb6\",\"value\":\"productVariant.inventoryQuantity\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"productVariant.inventoryQuantity\"},\"rhs\":{\"uuid\":\"cfeb3190-a63c-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cd5607c0-a63c-11ee-9ec8-37818f38ecb6\",\"value\":\"0\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:Int\",\"operator\":\">\",\"operation_type\":\"Comparison\"},\"rhs\":{\"uuid\":\"4270ab01-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270d212-a63d-11ee-9ec8-37818f38ecb6\",\"array_path\":{\"uuid\":\"4270ab02-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270ab01-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"productVariant.metafields\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"\"},\"array_item_key\":{\"uuid\":\"4270ab03-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270ab01-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"metafields_item\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"\"},\"operation\":{\"uuid\":\"cabace00-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270ab01-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"703d1053-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cabace00-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"4270ab05-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"703d1053-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"4270d210-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270ab05-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"metafields_item.key\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"metafields_item.key\"},\"rhs\":{\"uuid\":\"ed613250-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"4270ab05-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"is_hidden\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:String\",\"operator\":\"==\",\"operation_type\":\"Comparison\"},\"rhs\":{\"uuid\":\"703d1050-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"703d1053-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"703d1051-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"703d1050-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"metafields_item.value\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"metafields_item.value\"},\"rhs\":{\"uuid\":\"7342d640-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"703d1050-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"true\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:String\",\"operator\":\"==\",\"operation_type\":\"Comparison\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"},\"rhs\":{\"uuid\":\"cabaa6f0-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cabace00-a63d-11ee-9ec8-37818f38ecb6\",\"lhs\":{\"uuid\":\"cabaa6f1-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cabaa6f0-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"metafields_item.namespace\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"metafields_item.namespace\"},\"rhs\":{\"uuid\":\"cf9ddf70-a63d-11ee-9ec8-37818f38ecb6\",\"parent_uuid\":\"cabaa6f0-a63d-11ee-9ec8-37818f38ecb6\",\"value\":\"custom\",\"comparison_value_type\":\"LiteralValue\"},\"value_type\":\"EnvironmentScalarDefinition:String\",\"operator\":\"==\",\"operation_type\":\"Comparison\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"},\"operator\":\"ANY\",\"operation_type\":\"ArrayExpression\"},\"operator\":\"AND\",\"operation_type\":\"LogicalExpression\"}"}],"task_id":"shopify::flow::condition","task_version":"0.1","task_type":"CONDITION","description":null,"note":null,"name":null},{"step_id":"8a3cf290-a63d-11ee-9ec8-37818f38ecb6","step_position":[1620,1120],"config_field_values":[{"config_field_id":"address","value":"nobody@example.com"},{"config_field_id":"subject","value":"Inventory on is_hidden variant"},{"config_field_id":"message","value":"The following variant is hidden but has inventory:\nProduct: {{product.title}}\nSKU: {{productVariant.id}}\nVariant ID: {{productVariant.id}}"}],"task_id":"shopify::flow::send_email","task_version":"0.1","task_type":"ACTION","description":null,"note":null,"name":null}],"links":[{"from_step_id":"74ff21b0-a63c-11ee-9ec8-37818f38ecb6","from_port_id":"output","to_step_id":"78a175c0-a63c-11ee-9ec8-37818f38ecb6","to_port_id":"input"},{"from_step_id":"78a175c0-a63c-11ee-9ec8-37818f38ecb6","from_port_id":"true","to_step_id":"8a3cf290-a63d-11ee-9ec8-37818f38ecb6","to_port_id":"input"}],"workflow_name":"is_hidden notification"}}

Founder @ Ablestar ✦
Manage product data, spreadsheets, Google Shopping data, and metafields with Ablestar Bulk Product Editor. Use previews, undos, and automations to be confident your product data is correct.
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!