Skip to content
Install app
English
  • English
  • FrançaisSoon
  • DeutschSoon
  • EspañolSoon
  • ItalianoSoon
  • Português (Brasil)Soon
  • Português (Portugal)Soon
  • 日本語Soon
  • 한국어Soon
  • 简体中文Soon
  • 繁體中文Soon
  • NederlandsSoon
  • DanskSoon
  • SuomiSoon
  • Norsk (bokmål)Soon
  • PolskiSoon
  • ČeštinaSoon
  • TürkçeSoon

Theme selectors

Every selector the app uses to find things in your theme, and the two ways to change one.

The app finds your product form, price, variant picker, and cart lines by CSS selector. It ships a tuned set for every supported theme and a broad default set for the rest, which is why it works on most themes with no help.

A heavily customized theme can still put something where the defaults do not reach. There are two ways to fix that, and the first is almost always the better one.

1. Add the app’s own attribute

Nearly every selector begins with a data-gpo-… attribute that exists purely as a hook for you. Put that attribute on the element in your theme and the app finds it, with no selector to maintain and nothing that a theme update can rename.

<form action="/cart/add" method="post" data-gpo-product-form>
…
<button type="submit" data-gpo-product-atc>Add to cart</button>
</form>

The attribute for each selector is in the tables below.

2. Override the selector

Use this when you cannot edit the markup — a section you do not control, or an app rendering the form. Set it before the app’s script runs, in theme.liquid above </body>:

<script>
window.GPOConfigs = window.GPOConfigs || {};
window.GPOConfigs.theme = window.GPOConfigs.theme || {};
window.GPOConfigs.theme.product = {
...(window.GPOConfigs.theme.product || {}),
form: ['#my-product-form'],
addToCartButton: '.my-atc-button'
};
</script>

Your values are merged over the app’s, so you override only the keys you name.

product

Used on product pages, and on featured-product sections elsewhere.

KeyAttribute hookWhat the app does with it
formdata-gpo-product-formThe product form. This is the anchor for everything else — the options are rendered into it and validated on submit. Takes an array, tried in order
addToCartButtondata-gpo-product-atcThe add-to-cart button. Used to place the widget above it, and to block the submit when validation fails
paymentButton—The accelerated payment button. Hidden on products with options, because it would skip the form
quantity—The quantity input. Read so add-on quantities can follow the main product quantity
unitPricedata-gpo-product-unit-priceThe displayed price. Rewritten as the customer picks priced options
compareAtPricedata-gpo-product-compare-at-priceThe compare-at price, updated alongside it
variantSelectordata-gpo-product-variant-selectorThe hidden input holding the chosen variant id. Read to know which variant is selected
variantActivatordata-gpo-product-variant-activatorThe controls the customer clicks to change variant. Watched so variant conditions can react
variantWrapperdata-gpo-product-variant-wrapperThe block containing the variant pickers. Used to position the widget relative to them
imageContainerdata-gpo-product-image-containerThe main image area. Where the Personalizer draws its live preview
imagedata-gpo-product-imageThe main product image itself
imagesdata-gpo-product-imagesThe gallery images, for the preview's Apply to setting
imageButtondata-gpo-product-image-buttonThe gallery thumbnails or arrows, watched so the preview follows the image on show
sticky.atcButtondata-gpo-sticky-atcThe add-to-cart button in a sticky bar, so it validates like the real one
sticky.variantActivatordata-gpo-sticky-variant-activatorThe variant control in a sticky bar

collection

Used for quickview popups on collection pages.

KeyAttribute hookWhat the app does with it
wrapperdata-gpo-collection-wrapperThe collection section, the area the app watches
itemdata-gpo-collection-itemOne product card inside it
productLinkdata-gpo-collection-productLinkThe link to the product, read to know which product a card is
quickViewActivatordata-gpo-collection-qvActivatorThe control that opens the quickview, watched so the app knows to render
quickViewProductFormdata-gpo-collection-qvFormThe product form inside the quickview, where the options go

cart

Used on the cart page and in the cart drawer, for editing options and for keeping add-on lines tied to their parent item.

KeyAttribute hookWhat the app does with it
formdata-gpo-cart-formThe cart form. Takes an array, tried in order
pagesee belowHow to read a line item on the cart page. Takes an array of shapes, tried in order
drawersee belowThe same for the cart drawer

page and drawer each hold a lineItem describing the parts of one cart row:

PartAttribute hook (cart page)What it is
keydata-gpo-cart-item-keyThe row itself, carrying the line item key
imagedata-gpo-cart-item-imageThe row's thumbnail
detailsdata-gpo-cart-item-detailsThe title and properties block, where Edit Options is added
quantity.wrapperdata-gpo-cart-item-qty-wrapperThe quantity control, hidden on add-on lines
quantity.inputdata-gpo-cart-item-qtyThe quantity field
quantity.decrease / increasedata-gpo-cart-item-qty-decrease / -increaseThe minus and plus buttons
removeButtondata-gpo-cart-item-remove-buttonThe remove link, hidden on add-on lines

The drawer uses the same parts with data-gpo-drawer-item-… instead of data-gpo-cart-item-….

Notes

  • Keys taking an array are tried in order and the first match wins, so you can add yours in front of the defaults rather than replacing them.
  • Overriding a selector changes only where the app looks. It does not change what the options collect or how they are priced.
  • An override applies to every product page on the store. For one product, target it in the selector itself.

Was this helpful?

Report an issue