# Complement products

For every product we can assign a list of complement products. The complements are displayed in Shoppa when the base product is displayed and can be automatically assigned to templates to easily build multi-product signs.

*Note: Just because product A assigns product B as a complement does **not** mean the opposite is true. You must explicitly assign all relationships you want to use.*

## Adding two complement products

Lets assign a complement product to our sample product:

```markup
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
  <products>
    <product id="65467-14" idType="Code1">
      <complementProducts>
        <complementProduct id="65468-1" idType="Code1" />
        <complementProduct id="65468-3" idType="Code1" />
      </complementProducts>
    </product>
  </products>
</mediablob>
```

You can of course assign complement products at the same time you create your product or modify other properties of it. The only requirement is that the complement product already exists in Mediablob.

## Replacing existing complements

If you send a `<complementProducts />` list as above, the new complements will be merged with any existing complements and make the list of complements longer. If you instead want to replace the existing complements with a new list, you need to set `replace="true"`:

```markup
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
  <products>
    <product id="65467-14" idType="Code1">
      <complementProducts replace="true">
        <complementProduct id="65468-1" idType="Code1" />
      </complementProducts>
    </product>
  </products>
</mediablob>
```

The above xml effectively deletes complement `65468-3`, since it is no longer part of the list.

## Deleting all complements for a product

If you want to delete all existing complements for a product, you set `delete="true"` on the `<complementProducts />` section:

```markup
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7" xmlns="http://shoppa.com/mediablobSchema">
  <products>
    <product id="65467-14" idType="Code1">
      <complementProducts delete="true" />
    </product>
  </products>
</mediablob>
```

*Note that deleting the complements list does not delete the product itself.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shoppa.gitbook.io/knowledge-hub/api-documentation/xml-structure/complements.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
