Add prescription verification without installing an app
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.
One script tag in theme.liquid loads the widget on every page.
Use metafields, tags, or product type to flag prescription products.
The upload gate renders automatically before the Add to Cart button.
Go to Online Store > Themes > Actions > Edit code. Open theme.liquid and add the following before the closing </head> tag:
<!-- 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.
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.
Create a metafield: Settings > Custom data > Products > Add definition. Name it requires_prescription, type Boolean.
<!-- 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 %}Add the tag requires-prescription to any product in Shopify Admin.
<!-- 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 %}Set the product type to "Prescription" for all Rx products.
<!-- 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 %}If the customer is logged in, pass their email so prescriptions are linked to their account:
<!-- Optional: Pass customer email for prescription linking -->
{% if customer %}
<div data-customer-email="{{ customer.email }}"></div>
{% endif %}Show prescription status in the cart page:
<!-- 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 %}Sign up for a free account to get your API key and start verifying prescriptions.