Supplier catalogs

How to sum warehouse stock values in a supplier XML feed

2026-06-29
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

First create a new child node stock_total inside offer, then open its 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

  1. In the XML structure, create a new child node stock_total inside the repeated offer.

  2. Open the value settings.

    Opening stock_total in XML
    The animation shows selecting the field that receives the total stock.
  3. Add a rule: condition Any value, action Sum values, source {/catalog/offers/offer/warehouse/stock}.

    stock_total sum rule
    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>
    </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>
    </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>

Process data faster with Eofferix

Create a free account to automate catalogs and price lists around your own rules.

Sign up