Demo index

Pre-order data-attributes

While most customizations are handled through the PreProduct app, you can add special pre-order data-attributes to your PreProduct tagged buttons or snippet for custom functionality.

2 min read

Still stuck?

Ask the docs AI anything, or talk to the team. We usually reply within a few hours.

Contact us
Specify a pre-order ready button (should be combined with a data-id or data-starting-id)
data-native-pre-order-btn
Specify pre-order button wording
data-native-pre-order-btn="Pre-order me :)"
Take pre-orders like a product page from any page
data-headless="true"
Specify the starting variant for the button
data-starting-variant="123"
Specify a different redirect location (only compatible with the cart redirects)
data-cart-redirect-url="/fancy-thank-you-page"

Specify the isolated pre-order cart area
data-native-cart-pre-order-cta-container
Specify that a button should work in quick-buy mode when on pre-order
data-quick-pre-order
Specify the shop domain (useful for local host testing)
data-domain="mystore.myshopify.com"
Treat this buttons product like it's on a product page
data-primary-native-pre-order-btn
Set the quantity to add when on pre-order
data-pre-order-quant="2"

Custom Button Visibility Callbacks

PreProduct allows you to override the default show/hide behavior for pre-order and buy-now buttons using custom JavaScript callbacks. Add these data attributes to your native pre-order button:

The data-pre-order-btn-vis callback is called for each pre-order button when button visibility is changed

Controls pre-order button visibility
data-pre-order-btn-vis="myPreOrderVisHandler" 
javascript
window.myPreOrderVisHandler = (button, show, context) => {
  // button: The DOM element being toggled
  // show: Boolean - true to show, false to hide
  // context: Object containing { preorderButton, formattedListing }
  button.style.display = (show) ? '' : 'none';
}; 

The data-buy-now-btn-vis callback is called for each buy-now button when button visibility is changed

Controls buy-now button visibility
data-buy-now-btn-vis="myBuyNowVisHandler"
javascript
window.myBuyNowVisHandler = (button, show, context) => {
  // button: The DOM element being toggled
  // show: Boolean - true to show, false to hide
  // context: Object containing { preorderButton, formattedListing }
  button.style.display = (show) ? '' : 'none';
}; 

If no custom callback is defined, PreProduct uses its default visibility logic.

Screen walkthroughs

Pre-sell With PreProduct

7 day free trial with all plansMigrate pre-orders