Task
The supplier XML contains several warehouses inside one offer: warehouse/stock for north and south locations. The import needs a single total stock_total.
Short answer
Open the stock_total value settings and add a sum rule for {/catalog/offers/offer/warehouse/stock}. Eofferix will add all stock values inside the current item.
How to do it in Eofferix
In the XML snapshot, select the
stock_totalvalue inside the repeatedoffer.Open the value settings.

The animation shows selecting the field that receives the total stock. Add a rule: condition
Any value, actionSum values, source{/catalog/offers/offer/warehouse/stock}.
The rule sums warehouse stock values for the current item.
Before / after
Before
source data<catalog>
<offers>
<offer id="2001">
<sku>SKU-2001</sku><name>Hudson lamp</name>
<warehouse code="north"><stock>4</stock></warehouse>
<warehouse code="south"><stock>8</stock></warehouse>
<stock_total>0</stock_total>
</offer>
<offer id="2002">
<sku>SKU-2002</sku><name>Parker chair</name>
<warehouse code="north"><stock>0</stock></warehouse>
<warehouse code="south"><stock>3</stock></warehouse>
<stock_total>0</stock_total>
</offer>
</offers>
</catalog>After
result<catalog>
<offers>
<offer id="2001">
<sku>SKU-2001</sku><name>Hudson lamp</name>
<warehouse code="north"><stock>4</stock></warehouse>
<warehouse code="south"><stock>8</stock></warehouse>
<stock_total>12</stock_total>
</offer>
<offer id="2002">
<sku>SKU-2002</sku><name>Parker chair</name>
<warehouse code="north"><stock>0</stock></warehouse>
<warehouse code="south"><stock>3</stock></warehouse>
<stock_total>3</stock_total>
</offer>
</offers>
</catalog>What to keep in mind
- The sum should be scoped to the current
offer, not the whole XML file. - If some warehouses must be excluded, add warehouse-code conditions first.
- Keep a technical start value such as
0instock_totalso the field is easy to select in the snapshot.