A Group products rule collects the products that share the same group key: all the sizes of one shirt, or all
the offers for one barcode. You can then do one of two things:
- Keep one product per group and leave the rest out, so you stop sending eight near-identical rows for one shoe.
- Add computed fields to every product, such as "4 variants" or "from 19.99", to use in a title, a description or
an ad template.
Grouping is the mirror image of splitting variants into products: splitting
turns one row into many products, and grouping brings many rows together.
Add a Group products rule#
- Open the catalog from your project's Catalogs list and go to the Rules tab.
- Choose + Add rule, then set the action to Group products. The grouping editor opens.
- Choose Keep one product per group or Add computed fields to every product.
- Under Group by, name the value that identifies a group.
- Fill in Which product to keep, or the computed fields you want.
- Check the live count from a sample of your feed, such as "~50 products → ~12 groups in a sample", or "~12 kept"
when you keep one product per group. It shows whether your group key groups too much or too little.
- Choose Done, then Publish the catalog. The publish confirmation estimates how many products will be grouped
into other products, so you can check the size of the change first.
Choose the group key#
Products with the same group key are one group. The key can be a single value, such as a variant family ID, a barcode
or a style code. It can also be several values combined, and then products have to match on all of them.
Each part of the key has the same matching choice you get when joining another feed:
- Smart (the default) ignores capitalization and surrounding spaces.
- Barcode treats barcodes as equal even when one of them is missing leading zeros.
- Exact matches character for character.
A product with a blank group key isn't pooled with the other blank ones. It stays in a group of its own, so standalone
products are kept.
To group only part of your catalog, give the rule conditions. Products the conditions don't match are left alone.
Keep one product per group#
Only one product per group reaches your catalog, and the others are left out. You choose which one by naming a value and
whether the lowest or the highest of it wins, for example the product with the lowest price. Computed fields are
optional here: a rule that only keeps one product per group removes duplicates.
- A product whose value isn't a number loses to any product that has one. If no product in the group has a usable
number, the first one in your feed is kept.
- When two products tie, the first one in your feed is kept.
The catalog's import history counts the products left out under Grouped into other products, separately from
Excluded. For a step-by-step version of this job, see
Advertise only the cheapest variant.
Give the kept product a stable ID#
The kept product can change from one import to the next, when a different variant goes on sale or a price moves. If your
ID field is mapped to something that differs within the group, such as each row's own SKU, the ID changes with it,
and destinations treat that as a brand-new product.
To prevent this, map ID to your group key on the Mapping tab, so the ID stays the same whichever product is kept.
See Mapping your feed to catalog fields. The grouping editor warns you when the ID
doesn't come from the group key and offers Use group key as ID. You can still publish without it.
Add computed fields to every product#
Every product stays in your catalog, and each one gets new columns holding values computed across its group. A computed
field reads as a sentence: Take the Largest of {{stock}} as max_stock.
| Function | What you get |
|---|
| Count | How many products are in the group. Needs no value. |
| Distinct count | How many different values the group has, such as the number of colours in a family. Blanks aren't counted. |
| Sum | The total of a value across the group. |
| Average | The mean of a value across the group, such as an average price or rating. |
| Smallest | The lowest value in the group. |
| Largest | The highest value in the group. |
| Sorted first | The first value of the group in sorted text order, so "9 - shirt" comes before "10 - shirt". |
| Sorted last | The last value of the group in the same sorted order. |
| Values | Every value in the group, in feed order. |
| Distinct values | The same list with repeats and blanks removed, in feed order. |
| Any | true when at least one product in the group says yes, false when they all say no. A product with no yes/no value is left out. |
| All | true only when every product in the group with a yes/no value says yes. |
Numbers come out plain#
Sum, Average, Smallest and Largest write plain numbers. A lowest price of 20 gives 20, with no decimals or currency.
For a "from 20.00" line in your ads, add a Format number step with 2 decimals where you use the value. That writes
20.00, or 20,00 on a catalog whose language uses a decimal comma. Then add a Build text step to add the currency.
See Fixing your feed data with rules and
Steps: changing a value before it is used.
Sorted first and Sorted last#
These two pick one text value from the group, which Smallest and Largest can't do, because they skip a value like M.
They sort alphabetically, ignore capitals, and treat a number inside the text as a number, so 10 comes after 9. Empty
values are skipped.
Use them for text such as sizes. For numbers, use Smallest and Largest: negatives, thousands separators and decimals
don't sort as numbers here, so 1,200 sorts before 999.
Save a value from the winning product#
Smallest, Largest, Sorted first and Sorted last each pick one product of the group. In the and save box you can save
a different value from that product. Leave it empty, and it reads the same value and you get the computed value.
For example, to mark the variant with the most stock:
- In the Group products rule, add a computed field: Take the Largest of
{{stock}} and save {{id}} as
max_stock_id. Every product in the group now carries the ID of the product with the most stock.
- Below it, add a rule with the condition
id equals {{max_stock_id}} and a Set field action, for example
selected_for_meta = true.
One product per group now carries selected_for_meta, and a later rule can act on just that product. A few things
decide the result:
- On a tie, the first product in your feed wins, so reordering your feed can move the mark.
- A product whose stock isn't a number never beats one whose stock is. A group where no product has a stock value gets
no
max_stock_id, so none of its products is marked.
- If the winner's saved value is empty, the column stays empty.
- You can only save a value that exists at this point in the rules, so not a column written by a later rule or by this
same rule.
- In keep-one mode, the winner can be a product that gets left out, if you keep by one value and save by another. Keep
the cheapest and save the ID of the one with the most stock, and a later rule matching
id against the saved ID may
mark nothing in that group.
Any and All#
These read true/false, yes/no and 1/0 in any capitalization, and write true or false into your column.
Any of in_stock tells you the family can still be bought somewhere. All of on_sale tells you the whole family is
on sale.
Use the column#
A computed column behaves like any other column a rule creates. It appears in the Rule outputs list, and you can map
it to a catalog field, read it in a later rule or use it in an ad template. Count of products saved as
__variant_count becomes the "Available in 4 sizes" line in your ads.
- To compare a Count, Distinct count, Sum, Average, Smallest or Largest with is greater than and the like in a later
rule's conditions, set its column's type to Number under Rule outputs. Without that the conditions aren't
offered, and a comparison with a fixed number is refused at publish. A Smallest or Largest that saves another value
holds that value as it is.
- Rules run top to bottom, so a computed field is only available below the Group products rule. A rule above it sees
an empty column.
- A computed field can come out empty when no product in the group has a value it can read: a text value like
12 - SKU-7 is not a number. Nothing is written, so a fallback can take over, and any value the column already had
stays. Trace a product (the Trace button on the Rules or Mapping tab) shows why.
- The trace and the Rule outputs list group products from a sample of your feed, so they say "sampled products" and
a group can be larger at import.
Where the grouping sits in its rule#
Group products is an ordinary action, and its place inside the rule matters:
- Actions above it run first. Use this to build the column you group by: set a scratch column in the same rule, then
group on it.
- Actions below it run only for the products that survive: the kept product in keep-one mode, and every product in the
group in computed-fields mode.
- The grouping can sit in the "Otherwise…" branch, where it applies to the products the rule's conditions don't
match.
Use that last one when some products have an empty group key and you want each to export its own value. One rule handles
both cases:
When item_group_id is blank → Set field item_group_id to the product's id
Otherwise → Group products by item_group_id, keeping the lowest price
Products with a real group ID are reduced to the cheapest one. Products without one get a group ID of their own and stay
in your catalog.
Limits#
| Limit | What happens |
|---|
| One Group products rule per catalog | A second one is rejected when you publish, including one in an "Otherwise…" branch. |
| Grouping runs before splitting | You can't group products that a split produced, so put the Group products rule above the split rule. To group per variant, group on a value already on the original feed row. A split can read a value grouping created, because variants inherit their parent's columns. |
| Main product feed only | Grouping doesn't work on auxiliary feeds or mapping tables. |
| 1,000 values in a list | Values and Distinct values keep the first 1,000 values of a group, and the import warns you if there were more. |
| 100,000 different values in a group | Distinct count stays accurate up to here, then reports that the count is approximate. A group that big suggests the group key is wrong. |
| 250,000 groups in a feed | The import stops with a message telling you to check the group key. It may be unique per product, which means nothing is being grouped. |
Two more things to expect:
- Values a function can't read are skipped, and the import warns you, naming the column. Count and Distinct count always
write a number, and a Distinct count of
0 means no product in the group had a value.
- A Group products rule makes imports slower on a large feed. Renable normally skips products whose feed data hasn't
changed, but with grouping a change to one product changes the computed fields of its whole group.
Or ask Aimée#
Describe the outcome in the chat, such as "only advertise the cheapest variant of each shoe", and Aimée can set up the
rule and the ID mapping, then publish once you approve.
FAQ#
Does keeping one product per group delete my products?
They leave your catalog, so they don't reach your channels or ads, but they aren't gone for good. Remove the rule and
publish, and they're back after the next import. If ID is mapped to the group key, map it back to each row's own id
too: until then a whole family shares one id and only its first row is imported. Your edits to products that left are
kept for 30 days.
What's the difference between grouping and Item group ID?
Item group ID tells a destination which of your products are variants of one another. See
item_group_id and product variants. A Group products rule works inside Renable,
before anything goes out, either adding computed values or reducing the number of products you send. You can use both.