Joffre Ordinola Shopify Developer & E-commerce Specialist
|

PostHog · A/B Testing · Metafields · 2024 · Health & Wellness

PostHog-powered A/B framework that tests prices via metafields and injects the matching discount code at checkout automatically.

Price Testing

Problem:

The brand needed to find the optimal price point for a hero product without confusing returning customers or manually changing global store settings mid-test.

Solution:

A PostHog-powered A/B framework that reads test prices from product metafields, persists variant assignments via localStorage and cookies, and injects the matching discount code at checkout to honor the tested price end-to-end.

How it works:

PostHog manages variant assignment and feature flags. On page load, JavaScript reads test prices from product metafields and updates the displayed price. A cookie and localStorage store the assigned variant so returning visitors always see the same price. When the customer reaches checkout, a listener automatically injects the matching discount code into the checkout URL, with no manual intervention needed.

Tools:

  • PostHog
  • Metafields
  • JavaScript
  • localStorage / Cookies

More projects

See all projects
Theme Migration

Theme Migration

Full store rebuild on a modern Shopify stack, sections, metafields, and no legacy debt left behind.

Product Finder

Product Finder

A 4-step quiz that recommends a full gear setup, powered by Metaobjects and integrated with Klaviyo and GA4.