j-riv@localhost:~$

projects / commerce / Shopify Functions Suite

Shopify Functions Suite

private

A private Shopify app for configuring checkout discounts, delivery customizations, POS cart tagging, and checkout banners from an embedded merchant admin experience.

cat architecture.md

Hosted Shopify App

  • Provides an embedded admin interface for managing custom Shopify checkout behavior.
  • Packages the Remix application for deployment as a server-rendered Shopify app.
  • Uses environment-based configuration for Shopify app credentials and runtime settings.

Merchant Configuration UI

  • Gives merchants forms for product discounts, buy-x-get-y discounts, shipping discounts, and delivery customizations.
  • Uses Shopify Polaris and Shopify discount components to match the Shopify Admin experience.
  • Loads Shopify collection data so discount rules can target selected product groups.

Shopify Admin Integration

  • Creates and updates Shopify app discounts and delivery customizations through the Admin GraphQL API.
  • Stores checkout rule settings in Shopify app-owned metafields.
  • Supports both code-based and automatic discount configuration flows.

Authentication and Webhooks

  • Authenticates merchant admin requests through Shopify embedded app auth.
  • Persists Shopify sessions with Prisma-backed session storage.
  • Handles app uninstall webhooks by removing stored session records for the shop.

Checkout Function Logic

  • Evaluates product discount and buy-x-get-y eligibility during checkout using Shopify Functions.
  • Applies shipping discounts based on destination country, purchase threshold, delivery options, and variant exclusion metafields.
  • Hides or renames delivery options when configured cart, line item, or shipping option conditions match.

Checkout and POS Extensions

  • Displays configurable checkout banners in checkout and shipping sections.
  • Tags POS carts with a source attribute through a Shopify POS extension.
  • Uses the POS source tag to support channel-specific discount exclusions.

Data Storage

  • Uses Prisma and SQLite for Shopify session persistence.
  • Keeps discount and delivery rule configuration in Shopify metafields.
  • Relies on Shopify as the source of truth for merchant-created discounts and checkout customizations.

Reliability and Security

  • Scopes Shopify API access to the app capabilities declared in configuration.
  • Returns no-op results when checkout rule configuration is missing or eligibility checks fail.
  • Avoids storing discount rule state locally beyond Shopify session data.
# Why use Shopify metafields for rules?
Rule configuration is stored alongside Shopify discount and delivery customization resources, keeping checkout behavior tied to Shopify-managed objects instead of a separate app database.
# Why use Shopify Functions?
Shopify Functions let the app evaluate discount and delivery logic directly in checkout using Shopify cart, buyer, product, and delivery data.
# Why keep the database small?
The local database is limited to session persistence, while Shopify remains responsible for discounts, delivery customizations, and rule configuration.
# Why include POS tagging?
The POS extension gives checkout logic a reliable way to distinguish POS carts from other sales channels when applying exclusion rules.