Featured products: Add custom events when product is added to cart - eg. show slideout cart

The "Run custom code (advanced)" setting allows you to execute custom JavaScript code when a product is added to the cart in Design Pack sections. This feature enables seamless integration with your Shopify theme's cart functionality without modifying the core section code.

How It Works

When a user clicks an "Add to Cart" button in a Design Pack section with custom theme trigger enabled:

  1. The product is added to the cart

  2. Instead of refreshing the page or going to the cart page, your custom JavaScript code is executed

  3. This code can trigger your theme's cart drawer/popup or perform any other actions

Step 1: Enable setting

In your section or block settings, set the "Buy button action" to "Run custom code (advanced)".

Step 2: Add Your Custom Code

In the custom code field, add the JavaScript code that should run after a product is added to the cart.

Shopify Free Themes (Horizon)

Shopify Free Themes (Dawn, Refresh, Crave, Ride, Studio, Colorblock, Craft, Taste, Origin, Trade, Publisher, Sense, Spotlight)

Cart Type: Drawer

Cart Type: Popup Notification

Impact Theme

Expanse Theme

Impulse Theme

Prestige Theme

Motion Theme

Streamline Theme

Turbo Theme

Pipeline Theme

Don't see your theme here? Drop us a note at support@design-packs.com!

Last updated