How to Build a Shopify Product Labels App Using React Router (Step-by-Step Guide)

A Shopify Product Label App helps you display labels like:

  • “SALE”
  • “NEW”
  • “20% OFF”

If you’re working with Shopify stores, you’ve probably seen these types of labels. These small badges can make a big difference in how products perform.

In this guide, I’ll show you how to build a Shopify Product Label App using React Router (Remix-based setup), along with real code snippets and a working approach.

Why Product Labels Matter in Shopify Stores

Before jumping into code, let’s understand the business value.

Benefits for Store Owners

  • Increase product visibility
  • Improve conversion rates
  • Highlight offers instantly
  • Create urgency (SALE, LIMITED, etc.)

Benefits for Developers

  • Reusable app idea
  • High demand feature
  • Easy to extend (dynamic labels, automation)
Shopify product labels app onboarding screen
Simple onboarding flow for enabling labels in Shopify
Tech Stack Used

To build this app, we use:

  • Shopify Custom App
  • React Router (Remix architecture)
  • Node.js
  • Prisma ORM
  • PostgreSQL
Step 1: Shopify OAuth & Store Data Handling

When a merchant installs your app, you must store their shop and access token.

// app/routes/auth.callback.jsx

import prisma from "../db.server";

export async function loader({ request }) {
  const { session } = await authenticate.admin(request);

  await prisma.shop.upsert({
    where: { shop: session.shop },
    update: {
      accessToken: session.accessToken,
      installedAt: new Date(),
    },
    create: {
      shop: session.shop,
      accessToken: session.accessToken,
      installedAt: new Date(),
    },
  });

  return redirect("/");
}

This is essential for:

  • multi-store apps
  • API authentication
  • data separation
Step 2: Create Product Labels (Backend Logic)

Now let’s store label data.

await prisma.label.create({
  data: {
    shop: session.shop,
    labelType: "text",
    labelContent: "SALE",
    position: "TOP_LEFT",
    isActive: true,
  },
});

Always attach shopto every record.

Shopify label management dashboard
Manage product labels with status and actions
Step 3: Fetch Labels (Multi-store Safe)
const labels = await prisma.label.findMany({
  where: {
    shop: session.shop,
    isActive: true,
  },
});

This ensures:

  • each store sees only its data
  • no data leakage
Step 4: Label Customization (UI + Logic)

Your app allows:

  • Position selection (top-left, top-right, etc.)
  • Page visibility (product, collection, home)
  • Hover effects
await prisma.label.update({
  where: { id: labelId },
  data: {
    position: "TOP_RIGHT",
    showOnProductPages: true,
    hoverEffect: true,
  },
});
Shopify label editor interface
Customize label position and visibility
Step 5: Display Labels on Storefront

To show labels on the frontend:

// Example logic

const labels = await fetch(`/api/labels?shop=${shop}`);

labels.forEach(label => {
  // attach badge to product UI
});

You can use:

  • App Embed
  • ScriptTag API
Shopify product page with labels
Product labels displayed on storefront for better visibility
Step 6: Handle App Uninstall (Webhook)
await prisma.shop.update({
  where: { shop },
  data: {
    uninstalledAt: new Date(),
    accessToken: null,
  },
});

Prevents:

  • unused data
  • invalid API calls
Common Challenges in Shopify App Development

While building this, you may face:

  • OAuth complexity
  • Multi-store data handling
  • Theme integration
  • Performance issues

But once solved, you can reuse this architecture for many apps.

SEO Tips for Shopify App Developers

If you’re building apps like this:

  • Focus on real store problems
  • Keep UI simple
  • Add onboarding steps
  • Optimize database queries
  • Build reusable features
Conclusion

Building a Shopify app is not just about writing code. It’s about solving real problems for merchants.

A simple feature like product labels can:

  • improve UX
  • increase sales
  • make your app valuable

We hope this blog may be understandable and useful to you. You can email us at mage2developer@gmail.com if we missed anything or if you want to add any suggestions. We will respond to you as soon as possible. Happy to help 🙂

Need Further Help? or Questions?

Contact Us

Create your account

chatsimple