From 91d3d71b4a8f66504754b0f2516306c06ff4b1a3 Mon Sep 17 00:00:00 2001 From: Anh Pham Date: Mon, 11 Dec 2023 15:39:37 -0800 Subject: [PATCH 1/3] Add template: Tag products as 'on sale' if the price is lower than the compare price --- .../mesa.json | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json diff --git a/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json new file mode 100644 index 00000000..c7959cf8 --- /dev/null +++ b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json @@ -0,0 +1,80 @@ +{ + "key": "shopify/product/tag_on_sale_if_price_lower_than_compare_price", + "name": "Tag products as \"on sale\" if the price is lower than the compare price", + "version": "1.0.0", + "enabled": false, + "setup": true, + "config": { + "inputs": [ + { + "schema": 3, + "trigger_type": "input", + "type": "shopify", + "entity": "product", + "action": "updated", + "name": "Product Updated", + "key": "shopify", + "operation_id": "products_update", + "metadata": [], + "on_error": "default", + "weight": 0 + } + ], + "outputs": [ + { + "schema": 5.1, + "trigger_type": "output", + "type": "loop", + "entity": "loop", + "name": "Loop", + "version": "v2", + "key": "loop", + "operation_id": "loop_loop", + "metadata": { + "key": "{{shopify.variants[]}}", + "filter": { + "comparison": "equals" + } + }, + "local_fields": [], + "on_error": "default", + "weight": 0 + }, + { + "schema": 4.1, + "trigger_type": "output", + "type": "filter", + "name": "Filter", + "key": "filter", + "metadata": { + "a": "{{loop.price}}", + "comparison": "less than", + "b": "{{loop.compare_at_price}}" + }, + "local_fields": [], + "on_error": "default", + "weight": 1 + }, + { + "schema": 3, + "trigger_type": "output", + "type": "shopify", + "entity": "product", + "action": "tag_add", + "name": "Product Add Tag", + "key": "shopify_1", + "operation_id": "post_mesa_products_product_id_tag", + "metadata": { + "api_endpoint": "post mesa/products/{{product_id}}/tag.json", + "product_id": "{{shopify.id}}", + "body": { + "tag": "{{ template | label: 'What tag would you like to add to your sale products?', default: 'on sale', tokens: false }}" + } + }, + "local_fields": [], + "on_error": "default", + "weight": 2 + } + ] + } +} \ No newline at end of file From aa5285f9eb4230e4d4cada7bbbd06f285d7ad222 Mon Sep 17 00:00:00 2001 From: Anh Pham Date: Wed, 13 Dec 2023 10:48:52 -0800 Subject: [PATCH 2/3] QA feedback: Add filter step and change language --- .../mesa.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json index c7959cf8..4f82b90d 100644 --- a/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json +++ b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json @@ -21,6 +21,21 @@ } ], "outputs": [ + { + "schema": 4.1, + "trigger_type": "output", + "type": "filter", + "name": "Filter", + "key": "filter_1", + "metadata": { + "a": "{{shopify.tags}}", + "comparison": "does not contain", + "b": "{{ template | label: 'What tag would you like to add to products that are on sale?', description: 'Enter the name of the tag. Multiple tags can be separated by commas.', default: 'on sale', tokens: false }}" + }, + "local_fields": [], + "on_error": "default", + "weight": 0 + }, { "schema": 5.1, "trigger_type": "output", @@ -68,7 +83,7 @@ "api_endpoint": "post mesa/products/{{product_id}}/tag.json", "product_id": "{{shopify.id}}", "body": { - "tag": "{{ template | label: 'What tag would you like to add to your sale products?', default: 'on sale', tokens: false }}" + "tag": "{{ template | label: 'What tag would you like to add to products that are on sale?', description: 'Enter the name of the tag. Multiple tags can be separated by commas.', default: 'on sale', tokens: false }}" } }, "local_fields": [], From 49c98950037d9ab94a64548bb4c0413997af27b4 Mon Sep 17 00:00:00 2001 From: Anh Pham Date: Wed, 13 Dec 2023 10:50:53 -0800 Subject: [PATCH 3/3] Remove description --- .../tag_on_sale_if_price_lower_than_compare_price/mesa.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json index 4f82b90d..025e571f 100644 --- a/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json +++ b/shopify/product/tag_on_sale_if_price_lower_than_compare_price/mesa.json @@ -30,7 +30,7 @@ "metadata": { "a": "{{shopify.tags}}", "comparison": "does not contain", - "b": "{{ template | label: 'What tag would you like to add to products that are on sale?', description: 'Enter the name of the tag. Multiple tags can be separated by commas.', default: 'on sale', tokens: false }}" + "b": "{{ template | label: 'What tag would you like to add to products that are on sale?', default: 'on sale', tokens: false }}" }, "local_fields": [], "on_error": "default",