How can I assign or calculate product fields in bulk based on other field values?

You can assign simple or calculated values to many product fields at once  using bulk operations.

To assign values in bulk follow the steps below.

1. Go to products screen and choose product category from the left sidebar

2. Select Assign Field in the Bulk actions dropdown

assign-field

3.  Select target product field and operation Assign or Calculate

assign-field-target

4. Enter expression for assignment an click Apply

assign-field-expr

You can enter simple expressions like My description, 0, etc. or more complex that do calculations and reference other fields in the format {{Field}}.

Assign operations are simply overriding the value of the field, e.g.

Buy {{Name}} for {{Price}}.

You can for example add a currency symbol to the price:  $ {{Price}}.

Calculate operations evaluate mathematical expression:

  1. Arithmetic including brackets, e.g.
    ({{Price}} + 1) * 1.13
  2. Rounding to required decimal places
    round({{Price}} * (100 - {{Discount}}) / 100, 1)
  3. Adding fixed number of decimals
    ({{Price}}).toFixed(2)
  4. Other math functions, e.g.
    sin(45 deg) ^ 2

Our implementation uses Math.js library and you can read more at http://mathjs.org to learn what expressions, operations and functions are supported.

Leave a Reply

Your email address will not be published. Required fields are marked *