Calculations with custom fields

2
Please see this photo
i want to make Auto Sum in a Custom Field
please tell me How Please
i want to make many Of these … i know about programing and coding ( HTML )
but Please show me how i can do this
thanks

You can’t have auto summation in a custom field. What you could do is either:

  • Use infield calculations for the summary field:
3444823 + 848

Or

  • Drop the summary custom field altogether and use a custom theme to do the calculation for you.

2
OK
i made AA Custom Them But it’s empty
what should i do in this case ?
should i write codes in custom a and use it like in picture ?
and please code you tell me the code ? to sum in Field “Sum”

If you’re using a theme, you should drop the Sum custom field entirely since it’s not an input.

In the theme you can use this code to define the sum:

{% assign SUM = custom_fields['Field 1'].text | plus: custom_fields['Field 2'].text %}

And then you can place {{ SUM }} anywhere in your theme to display it in the View screen.



Ok i did like that
But i don’t understand ( And then you can place {{ SUM }} anywhere in your theme to display it in the View screen. )
please can you tell me exactly what i have to do ?
this is a sales Invoice page
i am so so sorry because i didn’t get it yet …
and thanks for your help … i wish to you happy Life :slight_smile:

@Ahmed_Saif, there is an illustrated Guide about calculations in themes using custom fields: https://www.manager.io/guides/17115.

I also retitled this thread. “Please help” does not get you assistance the way “Calculations with custom fields” would.

1 Like

Thank you, I wish you a happy life too :slightly_smiling_face:

But…

That’s not the way to do it. To be realistic, you probably need to hire a developer to do this for you. What I can do for you is give you a nudge in the right direction and I hope it helps.

  1. Go to the View screen of the Plain theme

  2. Copy to > New Theme

  3. Insert this at the beginning of the theme:

{% assign SUM = custom_fields['Field 1'].text | plus: custom_fields['Field 2'].text %}
  1. Insert this at the end of the theme:
Total field 1 & field 2: {{ SUM }}
  1. Name the theme and save it

  2. Use it to view the transaction in question

The placement of isn’t going to be “perfect” per se, but this as far as you can get without learning the basics of HTML and Liquid.

Alternatively, you can simply do this:

thanks

English only please on the forum, @mahmoud_osman.

You may not know English, but you can use translation software. Most of the forum members with the most experience do not know Arabic. Also, please do not double post your questions on two different topics.

1 Like