Free tool
Shopify Cart Drawer Animation Generator
Copy-paste Liquid + CSS for a Shopify cart-drawer animation.
Live preview · Slide in from right
Click Replay to re-run the drawer animation. Respects prefers-reduced-motion.
Liquid + CSS + JS · sections/cart-drawer.liquid
{%- comment -%}
Yokaify Cart Drawer Animation
Pattern: Slide in from right
Trigger: On add to cart
Drop into: sections/cart-drawer.liquid (or wherever your drawer lives).
Skips animations in the Theme Editor so saves don't replay them.
Bundle: < 2 KB. CLS: 0. Respects prefers-reduced-motion.
{%- endcomment -%}
<style>
/* Yokaify cart-drawer animation — slide in from right */
#CartDrawer {
transform: translateX(100%);
opacity: 0;
transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
opacity 320ms ease-out;
will-change: transform, opacity;
}
#CartDrawer.is-open,
#CartDrawer[aria-hidden="false"] {
transform: translateX(0);
opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
#CartDrawer { transition: opacity 80ms linear; transform: none; }
}
</style>
{%- unless request.design_mode -%}
<script>
(function () {
var drawer = document.querySelector('#CartDrawer');
if (!drawer) return;
function openDrawer() {
drawer.classList.add('is-open');
drawer.setAttribute('aria-hidden', 'false');
}
// Listen for add-to-cart events fired by Shopify section rendering API or theme JS.
document.addEventListener('cart:item-added', () => openDrawer());
document.querySelectorAll('form[action*="/cart/add"]').forEach((f) => {
f.addEventListener('submit', () => setTimeout(openDrawer, 60));
});
})();
</script>
{%- endunless -%}What this does
Pick a pattern, trigger, drawer selector, and duration. The generator gives you copy-paste Liquid and CSS for an animated Shopify cart drawer. No app, no framework.
A good cart-drawer animation:
- Confirms the add-to-cart so it feels like "yes, got it."
- Pulls the eye toward the Checkout button.
- Signals that the rest of the store is polished too.
Keep it subtle. A heavy, wobbly animation feels cheap and can annoy returning shoppers.
It will not break the Theme Editor
Shopify sets request.design_mode to true inside the Theme Editor. The snippet wraps its script in {% unless request.design_mode %}, so:
- On your live store, the drawer animates.
- In the Theme Editor, it stays still, so saving an unrelated section will not make it fly around.
More on this in request.design_mode.
Choosing a pattern
- Slide is the safe default. Calm and professional. Good for DTC, B2B, and luxury.
- Bounce is playful, with a small overshoot. Good for apparel, food, and pet. Avoid it where playful undercuts trust.
- Fade is minimalist. Use it when the drawer is busy with images or upsells.
If you are not sure, start with slide. You can tune the spring feel in the Framer Motion Spring Slider Builder.
Triggers
- On add to cart is the default and most useful. It confirms the action right away.
- On cart page load is only for the dedicated
/cartpage, not the drawer. - On any cart update fires on add, remove, and quantity changes. It can feel busy if the cart updates often.
Accessibility
For visitors with prefers-reduced-motion: reduce, the animation drops to an 80 ms opacity fade. That meets WCAG 2.3.3 by default. The drawer should also be keyboard-operable (focusable close button, Escape to close), which is handled at the theme level.
What to do next
- Pick pattern, trigger, drawer selector, and duration above.
- Copy the generated Liquid block.
- Paste it at the bottom of
sections/cart-drawer.liquidin your theme code editor. - Save, then add a product on the storefront. The drawer should animate.
- In the Theme Editor, click Save. The drawer should NOT replay.
- Toggle reduced motion on your OS and confirm it drops to an opacity fade.
Further reading
- ToolCountdown timer generatorThe companion zero-dependency embed for sale urgency.
- ToolFramer Motion spring slider builderTune the spring physics behind the bounce preset visually.
- GuideShopify chatbot 2026 buying guideWhere the cart-drawer animation fits in the Shopify conversion stack.
- GuideFrontend performance for ecommerce 2026The CWV discipline this generator was built to respect.
- BlogShopify cart drawer customization without breaking PageSpeedThe full deep-dive on cart-drawer customization patterns.
- Blogrequest.design_mode: protecting animations in the Theme EditorThe Shopify pattern this generator depends on.
Frequently asked questions
No. The snippet wraps its script in {% unless request.design_mode %}. The animation runs on the live site but skips in the Theme Editor.