← All Integrations

Shopify Manual Integration

Add prescription verification without installing an app

5-minute setupNo app requiredOnline Store 2.0

How It Works

This guide shows you how to manually add the RxCompliant prescription verification widget to your Shopify store by editing your theme files. No Shopify app installation is required. You'll add one script tag and a Liquid conditional to your product template.

1

Add widget script

One script tag in theme.liquid loads the widget on every page.

2

Tag Rx products

Use metafields, tags, or product type to flag prescription products.

3

Widget appears

The upload gate renders automatically before the Add to Cart button.

1Add the widget script to theme.liquid

Go to Online Store > Themes > Actions > Edit code. Open theme.liquid and add the following before the closing </head> tag:

theme.liquid
<!-- Add before </head> in theme.liquid -->
<script src="https://rxcompliant.com/widget/rxcompliant.js"
        data-api-key="YOUR_API_KEY"
        data-color="#2563EB">
</script>

Replace YOUR_API_KEY with your API key from the RxCompliant dashboard.

2Tag prescription products (choose one method)

Edit your product template file (sections/main-product.liquid or similar). Add the data-requires-rx div inside the product form, before the Add to Cart button.

Option A: Product Metafields (Recommended)

Create a metafield: Settings > Custom data > Products > Add definition. Name it requires_prescription, type Boolean.

sections/main-product.liquid
<!-- Option A: Using product metafields (recommended) -->
<!-- Add to sections/main-product.liquid or product-template.liquid -->

{% if product.metafields.custom.requires_prescription == true %}
  <div data-requires-rx
       data-product-id="{{ product.id }}"
       data-product-title="{{ product.title | escape }}"
       data-platform="shopify">
  </div>
{% endif %}

Option B: Product Tags

Add the tag requires-prescription to any product in Shopify Admin.

sections/main-product.liquid
<!-- Option B: Using product tags -->
<!-- Tag products with "requires-prescription" in Shopify Admin -->

{% if product.tags contains 'requires-prescription' %}
  <div data-requires-rx
       data-product-id="{{ product.id }}"
       data-product-title="{{ product.title | escape }}"
       data-platform="shopify">
  </div>
{% endif %}

Option C: Product Type

Set the product type to "Prescription" for all Rx products.

sections/main-product.liquid
<!-- Option C: Using product type -->
<!-- Set product type to "Prescription" in Shopify Admin -->

{% if product.type == 'Prescription' %}
  <div data-requires-rx
       data-product-id="{{ product.id }}"
       data-product-title="{{ product.title | escape }}"
       data-platform="shopify">
  </div>
{% endif %}

3(Optional) Pass customer email

If the customer is logged in, pass their email so prescriptions are linked to their account:

theme.liquid or product template
<!-- Optional: Pass customer email for prescription linking -->
{% if customer %}
  <div data-customer-email="{{ customer.email }}"></div>
{% endif %}

4(Optional) Cart validation

Show prescription status in the cart page:

sections/cart-template.liquid
<!-- Optional: Add to cart.liquid to show prescription status -->
{% for item in cart.items %}
  {% if item.product.metafields.custom.requires_prescription == true %}
    <div class="rxc-cart-status">
      {% if cart.attributes.rxc_uploaded == 'true' %}
        <span style="color: green;">Prescription uploaded</span>
      {% else %}
        <span style="color: red;">Prescription required —
          <a href="{{ item.product.url }}">upload here</a>
        </span>
      {% endif %}
    </div>
  {% endif %}
{% endfor %}

Testing Your Integration

  1. 1. Navigate to a product you flagged as requiring a prescription.
  2. 2. You should see the prescription upload widget above the Add to Cart button.
  3. 3. Try clicking Add to Cart without uploading — it should be blocked.
  4. 4. Upload a test prescription file. The widget should show progress, then a success state.
  5. 5. Check your RxCompliant dashboard to see the upload.

Ready to get started?

Sign up for a free account to get your API key and start verifying prescriptions.