About calculation in Shopify Flow

Solved
tekondo
Shopify Partner
4 0 3

I would like to perform a quadratic operation in ShopifyFlow.

As shown in the attached image(sorry in Japanese), I have entered the LIQUID code to achieve 1+1.

 

However, I get the following error

Liquid syntax error: Expected end_of_string but found number in "{{1 | plus 1 }}"

The error occurs because the type number cannot be cast to a type string, as in "{{1 | plus 1 }}".

 

Is it possible to realize this cast and perform the four arithmetic operations?

 

 

 

What I tried

Add a string with {{1 | plus 1 | append: ""}}.

Casting to a string with {{1 | plus 1 | string}}

I was not able to do the above.

 

I would appreciate it if you could tell me if you know anything about this.

Thank you in advance.

 

 

スクリーンショット 2022-05-18 16.23.08.png

Accepted Solution (1)
KWWriter
Shopify Staff (Retired)
Shopify Staff (Retired)
3 2 3

This is an accepted solution.

I miswrote earlier. You can enter Liquid in that field. It looks like you have a typo: {{ 1 | plus:1 }} . See https://shopify.dev/api/liquid/filters/math-filters#plus

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)
KWWriter
Shopify Staff (Retired)
Shopify Staff (Retired)
3 2 3

I understand what you're trying to do. Unfortunately, the Tags field doesn't accept Liquid code. This is why you're getting an error.  You can only enter text or a variable (by clicking </> and selecting the variable). 
You can add code only to fields that have the Add a variable link (which are usually found in actions that send messages).

To learn more visit the Shopify Help Center or the Community Blog.

KWWriter
Shopify Staff (Retired)
Shopify Staff (Retired)
3 2 3

This is an accepted solution.

I miswrote earlier. You can enter Liquid in that field. It looks like you have a typo: {{ 1 | plus:1 }} . See https://shopify.dev/api/liquid/filters/math-filters#plus

To learn more visit the Shopify Help Center or the Community Blog.