> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yuko.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Membership Validation at Checkout

> A Shopify checkout rule that stops customers who already have an active membership from buying another one.

<Note>
  **Where to find this:** Shopify admin → Settings → Checkout → Checkout rules. This isn't a tab in the Yuko admin; it's a Shopify Function (**yuko-membership-validation**) that ships with the Yuko app.
</Note>

## Introduction

Membership Validation is a cart and checkout validation function. When the cart contains a membership product, it checks whether the customer already has an active membership. If they do, checkout is blocked with the message **"You already have an active membership"**.

## What problem this solves

Without it, an existing member could buy a membership product again and end up with two paid subscriptions. Members who want a different plan should switch plans from their customer account instead (see [Profile Membership](/memberships/widgets/profile-membership)).

## Where it appears

* Shopify checkout. The error only shows when the rule blocks the purchase.

## When to use

* You sell more than one plan, or you want to make sure no customer pays for two memberships at once.

## Overview

* Runs on every cart and checkout validation.
* Looks for products tagged `YUKO:Membership:Product`. Yuko adds this tag to each plan's linked product.
* Checks whether the customer has the `YUKO:Membership` tag. Yuko adds it to customers with an active membership and removes it when they no longer have one.
* There's nothing to configure in Yuko; the message is fixed.

## Before you start

<Check>At least one membership plan exists in **Membership → Plans**, so its linked product carries the `YUKO:Membership:Product` tag.</Check>

## Setup guide

### 1. Turn on the checkout rule in Shopify

<Steps>
  <Step title="Open Checkout settings">
    In your Shopify admin, go to **Settings → Checkout**.
  </Step>

  <Step title="Add the rule">
    In **Checkout rules**, click **Add rule** and choose **yuko-membership-validation**.
  </Step>

  <Step title="Turn it on">
    Turn the rule on and save.
  </Step>
</Steps>

### 2. Verify

<Steps>
  <Step title="Test as an existing member">
    Log in as a customer with an active membership, add a membership product to the cart and go to checkout. You should see **"You already have an active membership"** and be unable to complete the order.
  </Step>

  <Step title="Test as a non-member">
    Repeat as a customer without a membership. Checkout should proceed normally.
  </Step>
</Steps>

## How it works

1. The rule reads the cart lines and the customer's tags.
2. If no line is a product tagged `YUKO:Membership:Product`, checkout continues.
3. If there is one and the customer has the `YUKO:Membership` tag, the rule returns an error and checkout is blocked.

### Limitations

* It only checks for an existing active membership. It doesn't restrict regular products to members.
* It relies on Shopify customer and product tags. Don't remove the `YUKO:Membership` or `YUKO:Membership:Product` tags manually.
* Guest checkouts without an identified customer can't be matched to a membership.

## Best practices

<Tip>**Turn on the profile widget too.** Members who want a different plan can upgrade or downgrade from their account instead of buying again.</Tip>

## FAQs

<AccordionGroup>
  <Accordion title="Can I use this to make products members-only?">
    No. The rule only stops existing members from buying a second membership.
  </Accordion>

  <Accordion title="Can I change the error message?">
    No. The message is set in the function.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Membership Plans" icon="id-card" href="/memberships/plans">
    Create paid plans with benefits, pricing and members.
  </Card>

  <Card title="Members" icon="users" href="/memberships/contracts">
    Manage each customer's membership, status and billing date.
  </Card>

  <Card title="Membership Widgets" icon="window" href="/memberships/widgets/cart-membership-upsell">
    Cart, checkout, profile and product-page widgets.
  </Card>

  <Card title="Membership Validation" icon="shield-check" href="/memberships/validation-extension">
    Stop existing members from buying a second membership.
  </Card>

  <Card title="Membership Emails" icon="envelope" href="/emails/membership-emails">
    Created, upgraded, downgraded and cancelled emails.
  </Card>
</CardGroup>

<CardGroup cols={2}>
  <Card title="Book a Free Setup Call" icon="phone" href="https://cal.com/rameshelamathi/yuko-demo">
    Talk to our team for personalised setup help.

    **Time:** 30 minutes
  </Card>

  <Card title="Contact Support" icon="life-ring" href="https://yuko.so/support/">
    Visit our support hub for help articles, live chat and ticket submission.
  </Card>

  <Card title="Browse the Guides" icon="book" href="/getting-started/welcome">
    Documentation across loyalty, referrals, memberships and more.
  </Card>

  <Card title="Install Yuko" icon="shop" href="https://apps.shopify.com/yuko">
    Add Yuko to your Shopify store from the Shopify App Store.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.