Skip to content

Instantly share code, notes, and snippets.

@unlocomqx
Created February 23, 2026 13:42
Show Gist options
  • Select an option

  • Save unlocomqx/19806c76cf2b4f950a27619e70f52c6f to your computer and use it in GitHub Desktop.

Select an option

Save unlocomqx/19806c76cf2b4f950a27619e70f52c6f to your computer and use it in GitHub Desktop.
window.dp = {
hook(container) {
const product_actions = document.querySelector('.product-actions,.js-product-actions');
if (product_actions) product_actions.prepend(container);
},
preview_hook(layers_container) {
const images_container = document.querySelector('.js-images-container');
if (images_container) images_container.prepend(layers_container);
},
selectors: {
/* used to update the price or the discounted price */
price: '.current-price-value, .product__current-price, .product__price, .current-price [itemprop="price"], .ce-product-price',
/* used to update the regular price */
regular_price: '.regular-price, .product__regular-price, .ce-product-price-regular',
/* used to detect the quantity change and recalculate the price */
qty_input: '#quantity_wanted',
/* used to detect the form submission and add the product to cart */
form: '#add-to-cart-or-refresh'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment