Skip to content

Add post-purchase subscription upsell extension with admin settings#40

Open
CaptainDiego wants to merge 5 commits intomainfrom
post-purchase-upsell
Open

Add post-purchase subscription upsell extension with admin settings#40
CaptainDiego wants to merge 5 commits intomainfrom
post-purchase-upsell

Conversation

@CaptainDiego
Copy link

@CaptainDiego CaptainDiego commented Feb 12, 2026

Summary

  • Adds a post-purchase checkout extension that offers customers a subscription upsell after completing their purchase
  • The offer product, discount percentage, and selling plan are configurable from the app's admin settings page
  • Product data is fetched from the Admin API at runtime, keeping Prisma storage lean (only config: variantId, discountPercent, sellingPlanId, enabled)

Key changes

  • Post-purchase UI extension (extensions/post-purchase-ui/) with support for one-time and subscription purchase options, buyer consent, and dynamic pricing
  • Admin settings section on the existing settings page with product picker, discount input, selling plan selector, and enable/disable toggle
  • API routes (/api/offer, /api/sign-changeset) that read config from Prisma and fetch product/variant/selling plan details from the Admin API via unauthenticated.admin(shop)
  • PostPurchaseOffer Prisma model for lightweight config storage (shop, enabled, variantId, discountPercent, sellingPlanId)
  • Shop domain extracted from the JWT token (input_data.shop.domain) for checkout-scoped API routes

Test plan

  • Open the app in admin → Settings → verify "Post-purchase upsell" section appears
  • Enable the offer, select a product with selling plans, set discount %, select a selling plan, save
  • Go through checkout with a physical product → post-purchase page shows the configured product
  • Accept the subscription offer → verify subscription contract is created on the order
  • Disable the offer → go through checkout → no post-purchase page appears
  • Note: Shopify Payments in test mode is required for subscription contracts on dev shops

🤖 Generated with Claude Code

Adds a post-purchase checkout extension that offers customers a subscription
upsell after completing their purchase. The offer product, discount, and
selling plan are configurable from the app's admin settings page.

Key changes:
- Post-purchase UI extension with one-time and subscription options
- Admin settings section for configuring the upsell offer (product picker,
  discount %, selling plan selector, enable/disable toggle)
- API routes (/api/offer, /api/sign-changeset) that read config from Prisma
  and fetch product data from the Admin API at runtime
- PostPurchaseOffer Prisma model for lean config storage
- Shop domain extracted from JWT token for checkout-scoped API routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CaptainDiego and others added 4 commits February 12, 2026 16:02
- Replace hardcoded tunnel URL with process.env.SHOPIFY_APP_URL
- Add shopify.app.*.toml to .gitignore (generated by shopify app config link)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Disable save button when no changes have been made (dirty state tracking)
- Disable form fields when upsell is toggled off
- Fetch selling plans immediately on product pick via Admin API
- Show spinner while loading selling plans
- Lock selling plan dropdown for products without selling plans
- Add dividers between sections and better empty state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace unreliable shopify: direct API with a Remix fetcher calling
a new /app/selling-plans loader. Selling plans now load immediately
when a product is selected without requiring a save+reload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant