Shopify Cart Drawer Pushes the Page? Fix It on Horizon

Horizon's cart drawer pushes the page sideways or opens without dimming it. Free fixes, code checked against Horizon 4.3.0, plus what to check if they fail.

By AjayCodeWiz · August 14, 2026 · 12 min read

The problem

You add something to the cart on your Shopify store, the cart drawer opens, and the whole page jumps sideways to make room for it. It does not float over the page like it used to. It shoves everything left.

A merchant hit exactly this on the Shopify Community. They were on the Horizon theme and asked for the "normal flyover cart" back, the kind that slides in over the page instead of pushing it.

I reproduced it on a test store running Horizon, found why it happens, and built a small fix. The page stops moving, and the cart floats over a dimmed page again. It is free, it is one block of code, and it does not need an app.

If you already tried a fix and it did not work, go straight to If the code did not work. Each cause there comes with the check that rules it out.

The Horizon cart drawer pushes the whole page sideways when it opensThe Horizon cart drawer pushes the whole page sideways when it opens

What a cart drawer is

A cart drawer is the little cart panel that slides out from the side when you add a product, so shoppers can see their cart without leaving the page they are on. Shopify themes also call it a slide cart, side cart, or mini cart.

The alternative is a cart page, where clicking the cart takes the shopper to a full /cart page and away from what they were browsing. A drawer keeps them on the page, which is why most stores prefer it.

Why Horizon pushes the page instead of floating over it

Horizon has two different behaviors for the cart drawer, and it switches between them based on screen width.

  • On phones and narrow screens (under 990 pixels wide), the cart opens as an overlay. It floats over the page, and the page behind it is locked so it cannot scroll.
  • On desktop (990 pixels and wider), Horizon slides the cart in and pushes the whole page sideways to sit next to it. There is no overlay and no dim. The page just shifts.

So nothing is broken. The desktop cart is a "squeeze" drawer by design, and there is no setting in the theme editor to turn it back into an overlay.

That is the whole reason merchants feel like the flyover cart "disappeared." On a wide monitor they only ever see the squeeze version.

The push arrived with Horizon 4.0. In Horizon 3 the cart floated over the page on every screen size. I checked the code against Horizon 4.3.0, the latest release on 15 October 2026, and the desktop push is still there.

First, a quick check before you touch code

Before the fix, rule out the simplest cause. Your cart might be set to open as a full page instead of a drawer. Horizon ships set to Drawer, but someone may have switched it to Page.

  • In your admin, go to Online Store, then click Edit theme on your Horizon theme.

The Edit theme button on the Horizon theme in Online StoreThe Edit theme button on the Horizon theme in Online Store

  • Open Theme settings, then Cart.
  • Look at the Type setting. If it is set to Page, switch it to Drawer and click Save.

Theme settings, Cart, with the Type setting switched to DrawerTheme settings, Cart, with the Type setting switched to Drawer

If Type was already set to Drawer and the page still slides sideways on desktop, you are seeing the squeeze behavior. The code below fixes that.

The fix: bring back the flyover cart on Horizon

The fix stops the page from shifting and adds a dim layer behind the cart, so the cart reads as a floating panel again. It only changes desktop, because your phone cart already floats.

Here is where the code goes.

  • In your admin, go to Online Store.
  • Next to your live Horizon theme, click the three dots, then Edit code.

The three-dot menu on the live Horizon theme, with Edit codeThe three-dot menu on the live Horizon theme, with Edit code

  • Open the file layout/theme.liquid. Liquid is the code Shopify themes are written in, and this file wraps every page of your store.
  • Scroll to the very bottom and paste the block below just before the closing </body> tag.
  • Click Save.

Open layout/theme.liquid in the code editor and paste before the closing body tagOpen layout/theme.liquid in the code editor and paste before the closing body tag

This is the code to paste:

{%- comment -%} Flyover cart drawer on desktop {%- endcomment -%}
<style>
  @media screen and (min-width: 990px) {
    .page-wrapper--drawer-open { margin-inline-end: 0 !important; }
    .page-wrapper--drawer-open #header-group > .shopify-section { z-index: calc(var(--layer-sticky, 8) - 2) !important; }
    .flyover-scrim {
      position: fixed;
      inset: 0;
      opacity: 0;
      pointer-events: none;
      background: rgba(0, 0, 0, 0.5);
      z-index: calc(var(--layer-sticky, 8) - 1);
      transition: opacity 0.25s ease;
    }
    .flyover-scrim.is-visible { opacity: 1; pointer-events: auto; }
  }
</style>
<script>
  (function () {
    var wide = window.matchMedia('(min-width: 990px)');
    var scrim = document.createElement('div');
    scrim.className = 'flyover-scrim';
    scrim.addEventListener('click', function () {
      var d = document.querySelector('theme-drawer[open]');
      if (d && typeof d.close === 'function') d.close();
    });
    document.body.appendChild(scrim);
    document.addEventListener('theme-drawer:open', function () {
      if (wide.matches) scrim.classList.add('is-visible');
    });
    document.addEventListener('theme-drawer:close', function () {
      if (!document.querySelector('theme-drawer[open]')) scrim.classList.remove('is-visible');
    });
    if (wide.matches && document.querySelector('theme-drawer[open]')) scrim.classList.add('is-visible');
  })();
</script>

The first line inside the style block stops the page from being pushed to the side. The second line moves your store's header, and the announcement bar above it, under the dim layer while the cart is open. Without it, Horizon draws the header on top of the cart, and the header's icons cover the first item in the cart. With a transparent header, Horizon also lifts the announcement bar above the cart, where it hides the cart's title and close button. The rest adds a dark, see-through layer behind the cart and lets a shopper click that dim area to close the cart.

Save it, then open your store on a desktop screen and add something to the cart. The page should stay put, and the cart should slide in over a dimmed page.

Fixed: the cart floats over the page and dims it, and the page no longer shiftsFixed: the cart floats over the page and dims it, and the page no longer shifts

On my test store the first version of this block stopped the page moving, floated the cart over it, and closed the cart when I clicked the dim. That version left the header drawn over the top of the cart, which is what the header line now fixes. I tested the current block on Horizon 4.3.0 at 1280 pixels wide, with the header set to transparent and with it off. If you pasted the block before 15 October 2026, replace it with the one above.

How to adjust it

Two things are easy to tweak.

  • Darkness of the dim. Change the 0.5 in rgba(0, 0, 0, 0.5). Use 0 for no dim at all, or a higher number up to 1 for a darker overlay. Something like 0.4 is a gentle dim.
  • If you do not want the dim or the click-to-close, keep only the first two lines inside the @media rule (the margin-inline-end line and the #header-group line) and delete the rest. The page stops shifting, and the cart floats over it without dimming anything.

Horizon 4: the cart opens over the page, but nothing dims

Horizon 4 has a second version of this problem. A merchant on Horizon 4.2.0 reported it on the Shopify Community: the cart drawer opened, the page behind it did not dim, and the page could still be scrolled.

Another reply had suggested editing two theme files so the cart opens as an overlay on desktop too. When we looked at the store, that part was in place: the page behind the cart was locked, so it no longer scrolled. But the dark layer that should sit behind the cart never appeared. The page looked exactly as it did before, just frozen, so it seemed like the edits had failed.

Horizon 4.2 cart drawer open on desktop, with the page behind it not dimmedHorizon 4.2 cart drawer open on desktop, with the page behind it not dimmed

The dark layer is there, but it has no colour. Horizon takes that colour from a shadow colour that used to come from the theme's colour schemes. Horizon 4.0 replaced colour schemes with colour palettes, and in the theme code from 4.0.0 to 4.3.0 nothing sets that colour any more. The layer is drawn fully transparent. The same layer sits behind the cart on phones, so a phone cart does not dim either.

The fix is one line of CSS that gives the layer a real colour. CSS is the styling code that controls how a theme looks. You do not need to open the code editor for this one, because Shopify has a Custom CSS box in the theme editor that applies to the whole store.

Add the overlay colour in Custom CSS

  • Go to Online Store in your Shopify admin.
  • Click Edit theme on your Horizon theme.
  • Click the Theme settings icon, the gear in the row of icons at the top left of the editor.

Theme settings icon in the Horizon theme editorTheme settings icon in the Horizon theme editor

  • Scroll down the list and click Custom CSS, just above Theme style.

Custom CSS at the bottom of the Theme settings listCustom CSS at the bottom of the Theme settings list

  • Paste this line into the box:
.theme-drawer__dialog::backdrop { background: rgb(0 0 0 / 0.5); }

The overlay line pasted into the Custom CSS boxThe overlay line pasted into the Custom CSS box

  • Click Save in the top right corner.

Save button in the theme editorSave button in the theme editor

Open your store on a desktop screen and click the cart. The page behind it now dims.

After: the page is dimmed behind the Horizon 4.2 cart drawerAfter: the page is dimmed behind the Horizon 4.2 cart drawer

We tested the line on the merchant's own live store, which runs Horizon 4.2.0. The overlay went from fully transparent to 50 percent black, and the page behind the cart stayed locked.

A few notes on this version of the fix:

  • The 0.5 sets how dark the overlay is. 0.3 gives a light dim and 0.7 a heavy one.
  • The line also dims the page behind the cart on phones, where Horizon already opens the cart as an overlay.
  • The line also darkens the page behind Shopify's chat drawer, if you use Shopify Inbox. Horizon builds both drawers the same way.
  • On older Horizon versions (3.x) the cart uses a different name for this layer. If the line does nothing on your store, add .cart-drawer__dialog::backdrop to it, like this: .theme-drawer__dialog::backdrop, .cart-drawer__dialog::backdrop { background: rgb(0 0 0 / 0.5); }.
  • Custom CSS is a theme setting, not a code file, so you never have to open the code editor to change or remove it.

Which fix do you need?

Open your cart on a desktop screen and look at the page behind it.

  • If the page slides sideways to make room for the cart, use the layout/theme.liquid block earlier in this article. It stops the push and adds its own dim layer.
  • If the page stays still and locks in place but does not darken, use the Custom CSS line in this section.

On an unedited Horizon 4 theme, the Custom CSS line changes nothing on desktop. There the cart opens as a side panel, not as an overlay, so the layer the line colours does not exist.

The Horizon 4.2 case came from <a href="https://community.shopify.com/t/problem-with-my-cart-drawer/688769" rel="nofollow">this Shopify Community thread</a>.

If the code did not work

Each cause below comes from how the Horizon code is built, and each has a check you can do in a minute.

  • The cart is set to Page. Horizon only adds the cart drawer to the page when Theme settings, Cart, Type is set to Drawer. It ships set to Drawer, but someone may have switched it to Page. Check that setting first, as shown at the top of this article.
  • You tested on the cart page. Horizon does not load the drawer on the /cart page, so the cart icon there opens the full cart page. Test from your home page or a product page.
  • The window is narrower than 990 pixels. The theme.liquid block only acts at 990 pixels and wider. Browser zoom counts too: at 125 percent zoom, a window 1,200 pixels wide reads as 960 pixels to the theme. Set the zoom to 100 percent and widen the window.
  • You edited a different theme than your live one. Your store shows only the published theme. Copies and theme updates sit under Draft themes, and an edit to a draft does not reach shoppers. Open Edit code from the theme at the top of the Online Store page, which is your live theme.
  • The code is in the wrong place, or part of it is missing. The whole block, from {%- comment -%} to </script>, belongs in layout/theme.liquid just before </body>. If you can see the code as text at the bottom of your store, a <style> or <script> tag was left out. Search the file for flyover-scrim: it should appear three times.
  • The two fixes were swapped. The theme.liquid block contains a script, and a script cannot run from the Custom CSS box. The one-line Custom CSS fix pasted into theme.liquid without <style> tags shows up as plain text on your store.
  • The header covers the top of the cart. That is the first version of this block, without the #header-group line. Replace your block with the current one. The same line fixes an announcement bar that sits over the cart's title, which happens when the header is set to transparent.
  • Your theme is not Horizon 4. The push started in Horizon 4.0, and the code above targets parts that only exist in Horizon 4. To see your version, go to Online Store and click the three dots next to your published theme. The menu lists it as Version, for example Version 4.3.0. If you are on Horizon 3, your cart already floats over the page, and only the Custom CSS line with .cart-drawer__dialog::backdrop applies.
  • An app replaces the cart. A slide cart app opens its own panel instead of Horizon's drawer, so code aimed at Horizon's drawer has no effect on it. In the theme editor, open App embeds, the list of pieces each installed app adds to your theme, and turn the cart app off for a moment. If the cart now changes, the app owns it, and its settings are where the change belongs. This guide covers cart drawers that come from an app.
  • It stopped working after a theme update. Shopify copies code edits into an updated theme when they do not conflict with the update. When they do, you have to copy them across yourself. Open layout/theme.liquid in the updated theme and search for flyover-scrim.

The three-dot menu on a Horizon theme in Online Store, showing Version 4.3.0The three-dot menu on a Horizon theme in Online Store, showing Version 4.3.0

The no-code alternative: a slide cart app

If you would rather not edit theme code, a slide cart app replaces the built-in drawer with its own overlay cart. One example is iCart Cart Drawer Cart Upsell.

These usually add more than just the overlay. Most of them bundle a free-shipping progress bar, upsell and cross-sell offers inside the cart, and a sticky cart button. If you want those extras anyway, an app can be a good trade. If all you want is the flyover behavior, the code above does it for free.

Will this slow my store down?

No. The code is tiny. It is a small block of CSS and a few lines of JavaScript that set up once when the page loads and then only act when the cart opens or closes. There is no external file to load and no app to install, so there is nothing measurable to slow a page down.

Does the fix affect mobile?

The theme.liquid block does not. It is wrapped in a rule that only applies at 990 pixels and wider, so your phone cart is left as it is.

The Custom CSS line does reach phones. It dims the page behind the phone cart, which Horizon 4 leaves undimmed.

Why is there no setting for this in the theme editor?

Horizon exposes a Cart Type setting for Page versus Drawer, but it does not expose a separate control for overlay versus push-style drawer. The push behavior on desktop is built into the theme, not offered as an option.

Because Horizon has no setting for it, the change has to be a small code edit or an app. That is why both the merchant and the people replying on the forum landed on "it needs a code edit."

Will a theme update undo this?

It can. When you update Horizon, Shopify adds the new version as a draft theme. It copies your code edits across when they do not conflict with the update, and when they do conflict you have to copy them yourself. Shopify's own advice is to save a copy of any customized code before you update.

So keep a copy of the code block somewhere safe. After an update, open layout/theme.liquid in the new version and check the block is still there before you publish it. If you use a slide cart app instead, an update will not remove it, since the behavior lives in the app rather than the theme file.

Cart drawer terms people mix up

  • Cart drawer. The cart panel that slides out from the side and keeps the shopper on the page.
  • Slide cart, side cart, mini cart. Different names for the same cart drawer.
  • Flyover or overlay cart. A cart drawer that floats over the page and dims it, rather than pushing the page aside.
  • Push or squeeze drawer. A cart drawer that shifts the page sideways to sit next to it. This is how Horizon's desktop cart drawer has worked since version 4.0.
  • Cart page. A full separate /cart page, the opposite of a drawer, which takes the shopper off the page they were on.

Summary

On Horizon 4, the desktop cart drawer pushes your whole page sideways by design, and there is no theme setting to change it. Below 990 pixels it already floats over the page.

To bring the flyover back on desktop, paste one block into layout/theme.liquid before </body>. It stops the page shifting, keeps the header under the cart, and dims the page behind it. If your cart already floats but the page behind it does not darken, add the one Custom CSS line instead.

If either fix did nothing, work through If the code did not work: the cart Type setting, the screen width, the live theme and the theme version cover most cases.

Spending too long on manual Shopify busywork?

PinFlow turns your Shopify catalog into Pinterest pins and posts them on a schedule, automatically. Set it once and let the system handle the timing, the same way a small code tweak can handle the rest.

Get PinFlow on the Shopify App Store

Answered on the Shopify Community

A merchant ran into this and asked about it on the forum. I worked through it on a test store and posted the fix there on August 14, 2026. You can read the original thread, including the follow-up questions, over on the Shopify Community.

View the original thread