Mastering Your Shopify Cart Drawer: How to Harmonize Button Sizes and Spacing

Hey there, fellow store owners! Let's talk about those crucial moments in your customer's journey: the cart and checkout. We all know how important a smooth, consistent experience is, especially when it comes to getting customers across the finish line. Recently, a great discussion popped up in the Shopify community that really highlights a common pain point: getting those cart drawer buttons to play nice and look uniform. It’s a small detail, but it can make a big difference in how polished and trustworthy your store feels.

The original post came from @siva_fds, who was grappling with button sizing in their Shopify premium theme’s cart drawer. Specifically, the "Add to Cart" button was a bit larger than the "Buy Now" button, creating an inconsistent look. If you've ever felt that slight visual imbalance on your own store, you know exactly what I'm talking about. It just feels... off.

Take a look at what siva_fds was seeing:

Screenshot 2026-05-21 at 6.11.37 PM

The Community Jumps In: Multiple Angles to a Common Problem

What I love about the Shopify community is how quickly everyone jumps in with different solutions, often tackling the problem from slightly different angles. This thread was a fantastic example of that collaborative spirit.

Simple Margin Adjustments for Spacing

The first few suggestions focused on evening out the spacing between the buttons, which often contributes to the visual imbalance. @devcoders offered a concise CSS snippet:

.cart__ctas>*+* {
    margin-top: 0!important;
}

This code targets the direct siblings within the cart's call-to-action area, effectively removing extra top margin. Here's what that might look like:

image

Then, @tim_tairli chimed in with an even simpler approach to clear margins:

.cart__ctas > * {
  margin: 0;
}

This snippet applies a zero margin to all direct children within the `.cart__ctas` container. Tim even provided helpful before-and-after visuals:

Before:

Screenshot 2026-05-21 at 11.55.56 PM

After:

Screenshot 2026-05-21 at 11.56.01 PM

The Comprehensive Solution: Button Normalization

While margin adjustments are helpful for spacing, the core issue of inconsistent *sizing* often requires a bit more. This is where @Wsp stepped in with a much more comprehensive set of CSS rules. Wsp's approach focuses on normalizing various button properties within the cart drawer, ensuring they all adopt a consistent look and feel.

  1. Cart Drawer Scoped Normalization: This code targets all relevant buttons within the `.cart-drawer` and sets their width, minimum height, padding, font size, and display properties to be consistent.
  2. .cart-drawer button,
    .cart-drawer .button,
    .cart-drawer a.button,
    .cart-drawer .shopify-payment-button__button {
    width: 100% !important;
    min-height: 48px !important;
    padding: 14px 16px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    }
    
  3. Fix ONLY Dynamic Checkout Button: Dynamic checkout buttons (like PayPal or Shop Pay) often have their own unique styling. This snippet specifically targets them to ensure their height and border-radius match the other buttons.
  4. .cart-drawer .shopify-payment-button__button {
    min-height: 48px !important;
    border-radius: 6px !important;
    }
    
  5. Fix Spacing Safely (Theme-Independent): Finally, to ensure consistent spacing between these harmonized buttons, Wsp adds a margin-top rule.
  6. .cart-drawer .button + .button,
    .cart-drawer .shopify-payment-button {
    margin-top: 12px !important;
    }
    

A Mobile-Specific Consideration

And let's not forget mobile! @Mustafa_Ali offered a solution specifically for smaller screens, which is a great reminder that responsive design is key. This code snippet targets a specific button class on screens up to 767px wide:


Mustafa also included an image, likely showing the mobile view after applying the fix:

image

Putting It All Together: Your Step-by-Step Guide to Harmonized Cart Buttons

Based on these excellent community contributions, here's how you can tackle button inconsistencies in your Shopify cart drawer, focusing on Wsp's comprehensive approach as a primary solution, and considering others as needed.

Before You Start: Safety First!

Always, always, back up your theme before making any code changes. Go to Online Store > Themes > Actions > Duplicate. This way, if anything goes awry, you can easily revert.

Adding the Custom CSS

The best place for these CSS changes is either in your theme's dedicated CSS file (like base.css or theme.css) or, for simpler additions, directly in the Custom CSS section of your theme editor.

  1. Navigate to Your Theme Code:
    • From your Shopify Admin, go to Online Store > Themes.
    • Find the theme you want to edit (ideally, a duplicate theme or the one you're actively building).
    • Click Actions > Edit code.
  2. Choose Your CSS File:
    • In the left-hand sidebar, under the Assets folder, look for files like base.css, theme.css, or custom.css. Select the most appropriate one (base.css is a common choice).
    • Alternatively, you can go to Online Store > Themes > Customize, then click the cog icon (Theme Settings) in the bottom left, and find Custom CSS. This is often the easiest for small snippets.
  3. Paste the Comprehensive CSS:

    Scroll to the very bottom of your chosen CSS file (or the Custom CSS box) and paste the following code from Wsp. This will normalize the general button styling, fix dynamic checkout buttons, and ensure consistent spacing.

    /* Cart Drawer Button Normalization (Wsp's Solution) */
    .cart-drawer button,
    .cart-drawer .button,
    .cart-drawer a.button,
    .cart-drawer .shopify-payment-button__button {
        width: 100% !important;
        min-height: 48px !important;
        padding: 14px 16px !important;
        font-size: 16px !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    
    .cart-drawer .shopify-payment-button__button {
        min-height: 48px !important;
        border-radius: 6px !important;
    }
    
    .cart-drawer .button + .button,
    .cart-drawer .shopify-payment-button {
        margin-top: 12px !important;
    }
    
  4. Consider Mobile-Specific Adjustments (Optional):

    If, after applying the above, you still notice inconsistencies on mobile, you might consider Mustafa_Ali's suggestion. However, I'd recommend adding it to your CSS file (e.g., base.css) within an @media query, rather than directly in theme.liquid, for better organization. If you must use theme.liquid, place it just before the tag.

    /* Mobile-specific adjustment (Mustafa_Ali's Solution) */
    @media screen and (max-width: 767px) {
    a.button.button--secondary.button--full-width {
        max-height: 60% !important;
        margin-top: 1rem !important;
    }
    }
    
  5. Save and Test:
    • Click Save.
    • Preview your store and open the cart drawer to ensure the buttons now appear uniform in size and spacing. Check on both desktop and mobile devices.

This community thread is a perfect example of how small styling tweaks can have a big impact on your store's professionalism and user experience. By implementing these CSS adjustments, you're not just fixing a visual glitch; you're streamlining a critical part of your checkout process, making it more appealing and trustworthy for your customers. Happy customizing!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases