# Buy X get Y: Code

> Theme code for the Buy X get Y widget from the app's theme code library, with where to paste it in Dawn and Horizon.

Source: https://backtrackhq.com/docs/widgets/buy-x-get-y/code/

Use this code where your theme has no slot for the app block. It comes
from the theme code library on the app's **Storefront blocks** page.
To open it, go to **Promotions** > **More actions** > **See all blocks**.

For every widget's code in one place, see
[Add AndOr with code](https://backtrackhq.com/docs/widgets/add-with-code/).

## One-line tags

Each tag is one line. The app embed fills it in with the same widget as
the matching app block.

> **Note:** Every tag needs the AndOr Discount Display app embed
> turned on. With the embed off, the tag shows nothing. See
> [what works without the app embed](https://backtrackhq.com/docs/widgets/app-embed/#what-works-without-the-app-embed).

Where to paste a tag:

- **Horizon:** in the theme editor, add a **Custom Liquid** block to
  the product template and paste the tag into it.
- **Dawn and similar themes:** paste the tag into the product section
  code, usually `sections/main-product.liquid`.
- **Cart claim rows tag:** paste it on the cart page, under the cart
  lines, for example in `sections/main-cart-footer.liquid`. On Horizon,
  add a **Custom Liquid** block to the cart template.

### Offer picker, one line

The **AndOr Offer picker** block as a single tag. It shows the Frequently bought together card, the Buy X get Y banner and the gift banner for the product on the page.

```liquid
<andor-offer-picker></andor-offer-picker>
```

(Screenshot: A product page with the pasted offer picker showing the Buy X get Y banner)

**Where it goes:** On a product page, wherever you want the card. The usual spot is under the add-to-cart button in `sections/main-product.liquid`. It has to be on a product TEMPLATE. Do not put it inside a product card or a related-products loop. There it would offer this page's deal beside a different product.

More: [Offer picker in One-line tags](https://backtrackhq.com/docs/developers/one-line-tags/#offer-picker).

### Cart claim rows, one line

The Buy X get Y claim row and the free gift slot on the cart page, as a single tag the app embed fills in.

```liquid
<andor-claim></andor-claim>
```

(Screenshot: The cart page with the pasted claim tag showing a Buy X get Y claim row with a Claim button)

**Where it goes:** On the CART page, under the cart lines. In Dawn that is `sections/main-cart-footer.liquid`, just before the cart totals. Or use `sections/main-cart-items.liquid`, after the items table. On Horizon, add a **Custom Liquid** block to the cart template. Anywhere else the tag stays empty. The cart drawer needs no tag. The app embed puts the rows there by itself.

More: [Cart claim rows in One-line tags](https://backtrackhq.com/docs/developers/one-line-tags/#cart-claim-rows).
