Browse articles

EComposer landing pages

Make add-to-cart buttons on EComposer landing pages open the EliteCart drawer instead of the cart page.

Last updated

EComposer builds landing and collection pages with their own add-to-cart buttons. This article shows how to make those buttons open the EliteCart drawer instead of sending customers to the cart page. Try the options in this order.

What you need

  • EComposer installed
  • EliteCart on any plan

Option 1: Detect external cart changes

  1. Open the Advanced settings

    In EliteCart, go to Cart designerOtherAdvanced.

  2. Check both settings

    In "Integration - detect theme changes", tick Detect external cart changes and Open cart drawer on external add-to-cart. They are on by default for new installs. Click Save.

  3. Test

    Open an EComposer page in a private browser window, add a product and check whether the EliteCart drawer opens. If EComposer still sends you to the cart page, use option 2.

Option 2: Custom add-to-cart selector

  1. Find the field

    In Cart designerOtherAdvanced, scroll to "Theme integration - add to cart" and find Custom add-to-cart selector.

  2. Add EComposer's button

    Enter EComposer's button selector together with your theme's own add-to-cart selector, separated by a comma (see the warning below).

  3. Save and test

    Click Save. Test an EComposer page and a normal product page.

form[action*="/cart/add"] button[type="submit"][name="add"], .ecom-collection__product-submit
Theme integration - add to cart card with the comma-separated selector ending in .ecom-collection__product-submit in Custom add-to-cart selector.

Option 3: EComposer's Ajax Cart extension

If you use EComposer's Ajax Cart extension, follow EComposer's guide, but instead of the theme-specific code it lists, add this:

<script>
document.addEventListener("DOMContentLoaded", function () {
  setTimeout(function () {
    if (window.EComposer) {
      window.EComposer.ajaxCartSuccess = function (data, form) {
        window.EliteCart?.openDrawerWithDataRefresh();
      };
    }
  }, 1000);
});
</script>

It tells EComposer to open the EliteCart drawer with the latest cart after a successful add.

Still stuck?

Chat with us and we'll help you get your cart live. Or email contact@elitecart.app.