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: