Unifying Your Shopify Product Page: Fixing Mismatched Buttons & Empty Cart Drawers (Royce Theme Insights)

Hey there, fellow store owners! It's easy to get caught up in the daily grind of running your Shopify store, but sometimes, those little technical glitches on your product pages can really throw a wrench in your conversion rates. Today, I want to dive into a couple of common headaches that came up in a recent community discussion, specifically around the popular Royce premium theme: mismatched 'Add to Cart' and 'Buy Now' button widths, and the dreaded empty cart drawer. Trust me, these aren't just cosmetic issues; they directly impact your customer's journey.

One of our community members, siva_fds, recently reached out with these exact problems, sharing a screenshot and even a video of the empty cart drawer in action. It's a classic scenario, and luckily, the community rallied with some fantastic insights and solutions. Let's break them down!

The Tale of Two Buttons: Matching Your Add to Cart and Buy Now CTAs

Ever notice how your 'Add to Cart' button looks one way, and then the 'Buy Now' or dynamic checkout button just below it seems a little off – maybe a different width or alignment? You're not alone! This is a super common issue, and as several experts in the thread pointed out, it's because these two buttons are often rendered by different systems.

The 'Add to Cart' button is typically part of your theme's core product form, while the 'Buy Now' button is a dynamic checkout button rendered directly by Shopify itself, often within its own wrapper. This difference in rendering can lead to conflicting CSS rules and, well, a mismatched look.

How to Diagnose and Fix Mismatched Button Widths:

  1. Test on a Duplicate Theme: Before making any live changes, always, always, always duplicate your theme. This lets you test freely without affecting your live store.
  2. Inspect with Developer Tools: This is your best friend for CSS issues. Right-click on both buttons and select 'Inspect' (or 'Inspect Element'). Look at their respective classes (e.g., .product-form__submit for Add to Cart, .shopify-payment-button__button for Buy Now) and their parent containers (e.g., .product-form__buttons, .shopify-payment-button). See what CSS properties are dictating their width or max-width.
  3. Check Theme Settings: As DanielBrooks8807 suggested, sometimes there's a max-width set within your theme's product template or section settings. It's worth a quick look in your theme editor under Online Store > Themes > Customize > Product template.
  4. Apply Custom CSS: The most straightforward fix is to apply some custom CSS that targets both buttons (and their immediate containers) to ensure they share the same width. Here's a robust snippet shared by DanielBrooks8807 that you can add in your Theme settings > Custom CSS section:
    .product-form__buttons,
    .shopify-payment-button {
      width: 100%;
      max-width: 100%;
    }
    .product-form__submit,
    .shopify-payment-button__button {
      width: 100%;
    }

    This code tells both the button containers and the buttons themselves to take up 100% of the available width, forcing them to align. Remember to adjust the selectors if your Royce theme uses slightly different class names – your DevTools inspection will tell you.

  5. Don't Forget Mobile! A common trap is fixing it for desktop only. Always test your changes on both desktop and mobile devices to ensure a consistent experience across the board.

The Mystery of the Empty Cart Drawer: Why Your Cart Isn't Showing Up

This one is a real conversion killer. Imagine a customer happily clicks 'Add to Cart,' the drawer slides open, but... it's empty! Or even worse, it just shows a lonely '1' or '2' without any product details. As NoahMueller wisely put it, a blank drawer can completely block the purchase path, so this needs to be fixed and verified before anything else.

The community discussion highlighted that this usually isn't an "add product" problem, but a "drawer rendering" problem. The product often *is* added to the cart, but the drawer itself isn't refreshing or displaying the updated cart content correctly.

Screenshot 2026-10-12 at 5.22.21 PM

Diagnosing the Empty Cart Drawer:

  1. Check the Cart Page Directly: After adding a product, immediately open a new tab and go to your store's /cart page.
    • If the item IS on /cart: Great! The product was successfully added. The problem lies with the cart drawer's rendering. This is often due to a JavaScript error, stale cart HTML being painted, or an app conflict.
    • If the item is NOT on /cart: This indicates an add-to-cart problem itself. Try adding a simple product without any app-related options (like bundles or subscriptions) to isolate the issue. If even a simple product fails, you might have a deeper theme or app conflict affecting the core add-to-cart functionality.
  2. Look for JavaScript Errors: When the drawer opens empty, open your browser's DevTools console (usually F12 or right-click > Inspect > Console tab). Reload the page, add a product again, and watch for any red error messages. A single JS error in your theme's cart script can halt the drawer's update.

Solutions for the Empty Cart Drawer (when item IS on /cart):

This is where the community really shined with some specific workarounds!

1. The Foxkit App Conflict (Specific Fix):

A brilliant insight from waisal.riyan identified a common culprit: the Foxkit app. It seems Foxkit targets the [data-cart-count] attribute, but if your theme (like Royce) also uses this attribute on the cart drawer wrapper, Foxkit might inadvertently replace the entire drawer content with just the item count. If you're using Foxkit, this is very likely your issue!

The Fix: Add the following script to your layout/theme.liquid file, immediately before the closing tag:

This script proactively removes the conflicting data-cart-count and data-cart-price attributes that Foxkit targets, allowing your theme's original cart code to function without interference. Remember to test thoroughly after implementing this!

2. General Cart Drawer Recovery (Robust Workaround):

If the Foxkit fix isn't applicable, or if your drawer is still showing just a number after adding a product, Hardeep provided a more general JavaScript recovery script. This script observes changes to the cart drawer and, if it detects that the content has been reduced to just a number (like '1' or '2'), it attempts to re-fetch the entire cart-drawer section and re-populate its content. It's like a built-in safety net!

The Fix: Add this JavaScript to your theme. You can place it in a new snippet (e.g., snippets/cart-drawer-recovery.liquid) and include it in your theme.liquid file, or simply add it directly to theme.liquid before the closing tag.

(() => {
  if (window.cartDrawerRecoveryInitialized) return;
  window.cartDrawerRecoveryInitialized = true;

  let recovering = false;
  let lastAttempt = 0;

  async function recoverCartDrawer() {
    const body = document.querySelector(
      '#cart-drawer-body-content'
    );

    if (!body || recovering) return;

    if (!/^\s*\d+\s*$/.test(body.textContent || '')) {
      return;
    }

    if (Date.now() - lastAttempt < 1500) return;

    recovering = true;
    lastAttempt = Date.now();

    try {
      const resp fetch(
        window.location.pathname + '?secti
        {
          credentials: 'same-origin',
          headers: { Accept: 'text/html' }
        }
      );

      if (!response.ok) {
        throw new Error(`Request failed: ${response.status}`);
      }

      const html = await response.text();
      const parsed = new DOMParser().parseFromString(
        html,
        'text/html'
      );

      const freshBody = parsed.querySelector(
        '#cart-drawer-body-content'
      );

      if (
        !freshBody ||
        !freshBody.querySelector('.cart-content-items') ||
        !freshBody.querySelector('cart-item')
      ) {
        throw new Error('Cart item markup not found.');
      }

      const currentBody = document.querySelector(
        '#cart-drawer-body-content'
      );

      if (
        currentBody &&
        /^\s*\d+\s*$/.test(currentBody.textContent || '')
      ) {
        currentBody.innerHTML = freshBody.innerHTML;
      }
    } catch (error) {
      console.error('Cart drawer recovery failed:', error);
    } finally {
      recovering = false;
    }
  }

  const drawer = document.querySelector('#cart-drawer');

  if (drawer) {
    const observer = new MutationObserver(recoverCartDrawer);

    observer.observe(drawer, {
      childList: true,
      subtree: true,
      characterData: true
    });

    window.cartDrawerRecoveryObserver = observer;
  }
})();

3. General App Conflict Troubleshooting:

If neither of the above direct code fixes works, or if you suspect a different app, you'll need to do some detective work. As several community members suggested, on your duplicate theme, try disabling app embeds one by one from your theme editor (Online Store > Themes > Customize > App embeds) and retest after each disable. This can help pinpoint which app is causing the conflict. Common culprits are apps that inject their own add-to-cart logic or modify the cart drawer, such as bundle apps, subscription services, or upsell pop-ups.

4. When to Contact the Theme Developer:

If you've tried all these steps on a fresh, unedited duplicate of the Royce theme and the cart drawer is *still* empty (even on the /cart page), then it might indicate a deeper issue with the theme itself. Since Royce is a paid theme, you're entitled to support from the theme developer. Provide them with your detailed test results – it'll help them diagnose the problem much faster.

Tackling these kinds of front-end glitches can feel daunting, but with the right diagnostic steps and community-tested solutions, you can restore your product page's functionality and aesthetics. Remember, a smooth customer journey is key to boosting those conversions! If you're just starting your e-commerce journey or looking to switch platforms, you can always explore what Shopify has to offer – it's a powerful platform, but like any robust system, it sometimes needs a little expert tweaking. Happy selling!

Share:

Use cases

Explore use cases

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

Explore use cases