Skip to content

10% off your routine with a Shopify discount limited to a segment

Goal: everyone whose “Find your routine” result is Dry gets 10% off the dry-skin routine with the code DRYROUTINE10, and nobody else can use it. A signed-in Dry shopper sees the offer at the top of every page; everyone else sees the store as it was.

Uses: the result tag or the result metafield Octane AI writes when Shopify Customers is on for the quiz, a customer segment, a Shopify discount code whose eligibility is that segment (Shopify: discounts), and a Custom Liquid section. No app, no Function, no API key. Available on the Plus and Enterprise plans.

Before you start: the quiz’s Storefront panel under Integrations > Shopify Customers prints this quiz’s real keys and its tag prefix. The key q3f9a12cd_winner and the tag find-your-routine:dry below belong to a fictional store; use yours. Put the routine’s products in a collection, here dry-skin-routine.

Customers, Segments, Create segment, and name it “Quiz result: Dry”. On the result tag:

customer_tags CONTAINS 'find-your-routine:dry'

or on the result metafield, which works with the tag switched off:

metafields.octaneai.q3f9a12cd_winner = 'Dry'

Discounts, Create discount, Amount off products:

  • Method: Discount code, DRYROUTINE10.
  • Value: Percentage, 10.
  • Applies to: Specific collections, dry-skin-routine.
  • Eligibility: Customer segments, “Quiz result: Dry”.
  • Maximum discount uses: Limit to one per customer, if the offer is once only.

In the theme editor, Header group, Add section, Custom Liquid. A question’s key can contain -, so read metafields with the bracket form:

{% if customer %}
{% assign octane_result = customer.metafields.octaneai['q3f9a12cd_winner'].value %}
{% if octane_result == 'Dry' %}
<div class="octane-offer">
Your dry-skin routine is 10% off with <strong>DRYROUTINE10</strong>.
<a href="/collections/dry-skin-routine">Shop it</a>
</div>
<style>
.octane-offer { padding: 8px 16px; text-align: center; font: 14px system-ui, sans-serif;
background: #ecfdf5; color: #065f46; }
.octane-offer a { color: inherit; text-decoration: underline; }
</style>
{% endif %}
{% endif %}
  • One segment and one discount per result; copy the three steps for Oily and Combination.
  • Shopify identifies the customer at checkout by their email address or phone number, so the code works for a shopper who checks out with the email or phone of the customer the result is on.
  • The tag and the metafield hold the current result: a retake that changes it moves the shopper out of the segment, and the code stops applying for them.
  • Only a shopper Octane AI matched to a customer is in the segment: one who took the quiz signed in, typed their account’s email in the quiz, or placed an order linked to the quiz.