Using flow to apply discounts after X period of time

Hi,

We currently use a paid app to apply ‘compare at price’ discounts based on time rules.

Wondering if the same is possible through flow. I had assumed it would be, but can’t find out how to do it.

Trigger: product added to store

Action: wait X days

Condition: check that product has stock

Action: apply compare at price based on % reduction

Anyone know if that is possible?

Hi @jake_mitchell

Flow does not currently have an action for applying a compare at price (see all available actions here)

There is a Send Http Request action that can be used to perform most actions in the Shopify Admin REST API. The specific endpoint you would want to use for this is https://shopify.dev/api/admin-rest/2022-07/resources/product-variant#put-variants-variant-id. You would fill out the http action headers following the curl example on the right side of the page. There is an added complication where you would need a http task for each variant since the endpoint works on a single variant and not a list of them.

In particular for the body you would want something like:

`{% for variants_item in product.variants %}

{% if [some condition that is only true for 1 variant %}
{“variant”:{“id”:{{variants_item.legacyResourceId}}, “compare_at_price”:{{variants_item.price | times: [some percent as a decimal] }}}}

{% endif %}
{% endfor %}

`

The trigger, wait and condition would all be possible as well.

Hi,

Thank you so much, @Jenny_W . If it helps, we would only be using this action for items for which there is only one product, no additional variations. It’s a second hand charity shop. Would that change the advice above?

In that case you would still need to loop over the variants because it would be a list with 1 element, but can omit the if statement since there is only 1 variant