How to show the offer in a custom position

Overview

The offer shows on the product page of product X. By default it places itself below the product form or below the product section, depending on the offer layout. To choose the position yourself, add the Buy X Get Y & BOGO app block in the theme editor, or paste a code snippet in your theme or page builder.

When the page has the app block or the code snippet, the offer shows there instead of in its default position.

Before you start

Use the app block

1. Add the Buy X Get Y & BOGO block

  1. In your Shopify admin, go to Online Store > Themes and click Customize.
  2. At the top of the theme editor, open your product template.
  3. In the left sidebar, click Add block in the Product information section.
  4. Open the Apps tab and select Buy X Get Y & BOGO from XB: Free Gifts & BXGY. To find it faster, type the app name in the search box.

Theme editor Add block panel, Apps tab, with two Buy X Get Y & BOGO blocks: one from Xboost Bundle and one from XB: Free Gifts & BXGY

If you also use XB: Bundles Quantity Breaks, the list shows two blocks with the same name. Pick the one with XB: Free Gifts & BXGY under the name.

2. Set up the block

Click the block in the left sidebar to see its settings:

Buy X Get Y & BOGO block settings with Link to featured product, Show example and Margin Horizontal

SettingWhat it doesDefault
Link to featured product (optional, only for featured products)Shows the offer of the product you select. Use it when the block is in a featured product section on another page, such as the home page. Leave it empty on product pages.Empty
Show exampleShows a sample offer in the theme editor when the product has no offer, so you can see the block. Shoppers never see the sample.On
Margin HorizontalSpace above and below the offer, from 0 to 120 px.16 px

3. Move the block and save

  1. Drag the block to the place you want, for example above the product title.
  2. Click Save in the theme editor.

The offer shows where you placed the block. In this example the block is above the product title, and the theme editor shows the sample offer:

Theme editor preview with the Buy X Get Y offer above the product title

Use the code snippet

Use the code snippet with a page builder or when you edit theme code.

  1. Open Offers, click the offer name, then click Offer.
  2. Below Pricing setting, copy the code under Use this code for custom placement or page builders (Optional).

Use this code for custom placement or page builders (Optional) with the code snippet

  1. Paste the code in your product page template or page builder where the offer should show:
<div id="xb-buy-x-get-y-v2-root"></div>

Use the snippet once per page. The code is the same for every offer: the app shows the offer of the product on that page.