App blocks

Gift with Purchase block

Reference for the deprecated Gift with Purchase theme app block, its placement, and every schema setting.

The Gift with Purchase block renders a gift-with-purchase campaign directly inside your Online Store theme. It loads a layout-specific script (list, collapsable, slider, or modal), optionally pulls in the quick view modal, and exposes a full set of {% schema %} settings for appearance, behavior, and placement.

This block is deprecated. Its schema name is GiftPurchase (Deprecated) and it is only available when the legacy customizer metafield is present. For new campaigns, use the Upsell Widget block instead.

Purpose

The block is a Shopify theme app extension that surfaces gift-with-purchase products tied to a campaign. At render time it picks a script based on the chosen layout:

Layout settingScript loaded
collapsablelcuGiftPurchaseCollapsable.js
modallcuGiftPurchaseModal.js
sliderlcuGiftPurchaseSlider.js
anything else (list)lcuGiftPurchaseList.js

The resolved library is loaded through the lib-loader snippet and injected once via inject-unique-lib. When Enable quick view is on, or when the product click action is set to quick view, the lcuQuickViewModal.js library is injected as well.

Placement

The block targets the section area of a theme, so you add it through the theme editor on a section that supports app blocks. The campaign it displays is bound by the Campaign ID setting.

You can also detach the block from its default position and render it inside any element on the page using the Embed control settings. When Embed block is enabled, the block is inserted relative to the element matched by Embed selector, at the position chosen in Placement (the values map directly to the DOM insertAdjacentElement positions).

Availability is gated by available_if: "{{ app.metafields.deprecation.customizer_2024_02 }}". If that metafield is not set, the block does not appear in the theme editor.

Schema settings

All settings live under the block's {% schema %}. They are grouped by the headers defined in the schema.

General

Setting (id)TypeLabelDefaultNotes
widgetIdtextCampaign IDCampaign ID is available in the Admin Panel.
themeColorcolorBrand color#000
backgroundColorcolorBlock background color#f4f4f4
addButtonTitletextProduct button titlesAdd|Adding...|AddedUse | to define the three button states.

Appearance

Setting (id)TypeLabelDefaultNotes
layoutselectLayoutsliderOptions: list (recommended for smaller screens), collapsable, slider.
listLayoutselectList layouts typeslider|horizontalOptions: slider|horizontal, slider|vertical, list|vertical, list|horizontal.
slidesPerViewDesktoprangeProducts per view from 1024px6min 1, max 10, step 0.5.
slidesPerViewTabletrangeProducts per view from 480px to 1024px4min 1, max 8, step 0.5.
slidesPerViewMobilerangeProducts per view up to 480px2min 1, max 4, step 0.5.
spaceBetweenrangeSpace between products10min 0, max 100, step 5, unit px.
conditionAutoPlayrangeConditions autoplay0min 0, max 30, step 0.5, unit sec. Set to 0 to disable. Available only when Layout is List.
autoPlayrangeProducts autoplay0min 0, max 30, step 0.5, unit sec. Set to 0 to disable. Available only when List layouts type is a Slider list.

Additional Settings

Setting (id)TypeLabelDefaultNotes
initialCollapseOpencheckboxInitial Collapse opentrueApplies to Collapsible and Slider layouts.
hideOutOfStockcheckboxHide out of stock productstrue
enableQuickViewcheckboxEnable quick viewfalseUses a modal to quickly preview a product.
disableLinkRedirectioncheckboxDisable product link redirectionfalseWhen checked, product links open the quick view modal instead of the product page.
borderRadiusrangeBorder radius0min 0, max 50, step 1, unit px.

Content

Setting (id)TypeLabelDefaultNotes
primaryTitletextPrimary title (Deprecated)Use {difference} for the price difference from your campaign rules.
primarySubtitletextPrimary subtitle (Deprecated)Use {difference} for the price difference from your campaign rules.
titleOnValidtextTitle on valid campaign (Deprecated)
subtitleOnValidtextSubtitle on valid campaign (Deprecated)

The Content fields are individually marked Deprecated in the schema. The {difference} token in the title and subtitle is replaced with the price difference defined by your campaign rules.

Embed control

Setting (id)TypeLabelDefaultNotes
isEmbedcheckboxEmbed blockfalseRender the block inside a given target.
embedSelectortextEmbed selectorbodyCSS selector of the target where the block is rendered.
whereradioPlacementafterbeginWhere to place the block relative to the target. See values below.
customCsstextareaCustom CSSPlaceholder example: .app__product__image { border: 1px solid red; }.

The Placement (where) values:

ValueMeaning
beforebeginBefore the target.
afterendAfter the target.
afterbeginBefore the first child of the target.
beforeendAfter the last child of the target.

Example

A minimal embedded configuration that renders the slider layout inside a custom container:

{% comment %} Block settings (configured in the theme editor) {% endcomment %}
widgetId            = "your-campaign-id"
layout              = "slider"
isEmbed             = true
embedSelector       = ".product-form__buttons"
where               = "afterend"
addButtonTitle      = "Add|Adding...|Added"

On this page