Skip to main content

Calculate Mutation

The Calculate mutation allows you to perform calculations on numerical values in a specific product field. This mutation is useful for adjusting prices, computing margins, and more.

Options

  • Expression: The mathematical expression used for the calculation. Supports basic arithmetic operators.
    • Divide (/): Divides the value by the given number.
    • Multiply (*): Multiplies the value by the given number.
    • Add (+): Adds the given number to the value.
    • Subtract (-): Subtracts the given number from the value.
info

For this mutation you can choose a special Inject value. This value takes the result of the previous mutation (or the raw input if none). This is so you can choose which side of the operator the previous value is on.

Example

In this example we want to use a custom_label to see how much profit in % we have for a certain product. We do this with a series of calculations to get the profit in %, by dividing the profit with the price (profit/price) and then check if they're between some intervals that we've choosen.

info

The profit is a computed value that Feedr provides. However it requires that we know the cost of the product

A screenshot showing the Calculate mutation.
Calculate Mutation Example
A screenshot showing the Calculate mutation.
Calculate Mutation Example