Props: product page upsell and product lists
Every prop your template receives for Product Page Upsell offers and Product List Widgets.
Product Page Upsell
Open the offer, go to the Design tab and scroll to the end. A Custom Templates button opens the Template library, and the Custom template card below it holds the editor. Its title names the slot you are editing: Cross-sell ยท Carousel, Cross-sell ยท Stacked, Product add-on ยท Carousel, Product add-on ยท Stacked, FBT ยท Stacked or FBT ยท Horizontal. The slot follows the offer type and layout. Each slot keeps its own code and its own switch; only the slot that matches the offer's current type and layout runs.
The editor is always shown on this tab, whatever the Enable custom template editors setting says. The template replaces the whole offer block. It only reaches the storefront while the offer is Active.
Block props
| Prop | Type | Meaning |
|---|---|---|
isPreview | boolean | |
offerType | string | "CROSS_SELL", "FREQUENTLY_BOUGHT_TOGETHER" or "PRODUCT_ADDON". |
layoutType | string | "CAROUSEL", "STACKED" or "HORIZONTAL". |
customBaseKey | string | The slot in use, such as "crossSellCarousel". |
titleHtml | string | The offer title, with &, < and > escaped. |
buttonTextHtml | string | Button text with variables filled in. |
moneyFormat, shopLocale | string | |
showArrows, showCheckboxes, showAddButtons, showClaimOffer, showPlusIcon | boolean | What the offer shows. |
claimDisabled, isClaimLoading, isClaimSuccess | boolean | Claim button state. |
itemsPerPage | number | |
containerStyleVars, titleStyleVars, navStyleVars, gridStyleVars, horizontalWrapperStyleVars, claimButtonStyleVars, claimButtonIconStyleVars, plusIconStyleVars | object | Style objects. |
summary | object | The totals block, see below. |
products | array | See below. |
onCarouselPrevious(), onCarouselNext() | function | Scroll one page. |
onClaimOffer() | function | Adds the selected products. |
builtInModule | node | The whole built-in offer. |
summary has: titleHtml, savingsBadgeHtml, discountedPriceHtml, originalPriceHtml, totalHtml, totalOriginalHtml, itemCount (number), showTitle, showSavingsBadge, hasTotals (booleans), and the style objects titleStyleVars, discountedPriceStyleVars, originalPriceStyleVars, savingsBadgeStyleVars.
Each products entry has: id, title, handle, productUrl, imageUrl, isSelected, isTrigger (the product page's own product in an FBT offer), isLoading, isSuccess, hasDiscount, price and discountedPrice (numbers in whole currency units), priceHtml, discountedPriceHtml, selectedVariantId, variants (array of id, title, available), onToggleSelect(checked), onAddToCart(), onVariantChange(variantId), and style objects itemStyleVars, titleStyleVars, variantStyleVars, priceStyleVars, discountedPriceStyleVars, checkboxStyleVars, buttonStyleVars, variantIconStyleVars, buttonIconStyleVars.
Template library
Click Custom Templates. The sheet is titled Template library with the offer type, and says its previews use the offer's title, button text and discount on sample products. Each card shows a preview, a title, a description, a layout badge when the template is made for one layout, and Use template. The card in use shows In use. A template that does not compile shows "No preview: this template doesn't compile." and cannot be used.
Use template compiles the template, fills the slot, switches it on, and moves the offer to the template's layout if it was made for another one. If the slot holds code you wrote by hand, you are asked Replace your edited template? ("Your changes in the code editor will be replaced by this template.") and answer Replace or Cancel. The templates in the library are published by Oxify; you cannot add your own to it.
Product List Widgets
Open the widget, go to the Design tab and scroll to the end: the Custom Templates button and a Custom template card with one tab. The editor is always shown, whatever the Enable custom template editors setting says. It uses the same Template library sheet (with Use template) and a template that fails to compile is applied to the editor but not switched on ("Template applied โ compile failed; use Compile in the editor").
The template replaces the whole list (title and products). Oxify keeps the widget's custom CSS when a template is active. A widget with no products shows nothing outside the preview.
Props
| Prop | Type | Meaning |
|---|---|---|
isPreview | boolean | |
titleHtml | string | Widget heading (HTML). |
titleStyleVars, containerStyleVars, gridSliderStyleVars | object | |
titleAlignment | string | Saved alignment, default "center". |
arrowColor | string | |
products | array | See below. |
showSuggestionsAsSliderForDesktop | boolean | |
carouselItemWidth, carouselPadding, modernCarouselPadding | string | "100%", "0px 4px", "0px 20px". |
showTitleArrows | boolean | True for Modern Carousel. |
onCarouselPrevious, onCarouselNext, onArrowLeftClick, onArrowRightClick | function | |
carouselRef | ref | Used by the built-in carousel. |
customHtmlAndCss, renderCustomHtml(position) | object, function | The widget's custom HTML settings, and a function that renders one position. |
rootId | string | A unique id for this widget placement. |
There is no builtIn prop for this editor.
Each products entry has: id, title, productUrl ("#" in the preview), imageUrl, buttonText, hasMultipleVariants, variantOptions (array of name, values, selectedValue, onChange(value); undefined for single-variant products), isAddDisabled (true when the chosen variant is sold out; the button text is then "Sold out"), isLoading, onAddToCart(), priceHtml, compareAtPriceHtml, showCompareAtPrice, reviews (node), vendorText, showVendor, savingsHtml, savingsPosition, cardWidthVar, and style objects sliderCardStyleVars, gridSliderButtonStyleVars, containerStyleVars, imageStyleVars, cardStyleVars, titleStyleVars, priceStyleVars, originalPriceStyleVars, buttonStyleVars, savingsStyleVars, spotlightImageStyleVars, spotlightAddButtonStyleVars, spotlightTitleStyleVars, vendorStyleVars.