Skip to content

E-commerce 0.5.0: Products from Catalogues, per-domain currency and Shopify media

E-commerce 0.5.0 lets the PhoenixKit shop sell items from the Catalogues module, shows each visitor prices in their domain’s currency, and brings Shopify images, variants and collections into the shop.

Products from Catalogues

The shop can now read its products and categories from the Catalogues module instead of its own tables. The switch is the shop_product_source key in the shop config; the default stays the shop’s own tables, and the catalogue source stays off while Catalogues is not installed. Catalogue item and category forms get a shop section for the shop fields. Storefront filters and the option picker work on catalogue attribute sets, with labels in each language.

Prices in the visitor’s currency

A cart now keeps its display currency, the base currency and the exchange rate from the moment it was created, and line prices are fixed at that rate. Orders copy the same values. Free-shipping thresholds are compared in the base currency. Open storefront pages update when rates change, and checkout warns when a cart’s rate is out of date. When the base currency changes, catalogue amounts can be repriced for shops on the shop’s own tables; catalogue-backed shops refuse the change.

Shopify images, variants and collections

The Shopify sync now stores images in Storage, turns product options and variants into catalogue attribute sets, and turns collections into categories with their order. These run as background jobs on the shop_imports queue. Shopify descriptions are converted from HTML to Markdown.

Storefront

The product page has a two-column layout, the gallery beside the buy box, with the description and specifications under the gallery. Users with shop permission see an edit link on shop, category and product pages. A product with no price no longer shows “100% OFF”, and a guest cart merged into an account cart in another currency is converted properly.

Upgrading

E-commerce 0.5 needs PhoenixKit core 2.15 or later and Billing 0.13 or later; a project pinned below either cannot resolve its dependencies. Run mix phoenix_kit.update so core’s migrations add the cart currency columns. The module now also depends on mdex for Markdown. Shops that keep the default product source keep their products where they are.

Full release notes: E-commerce 0.5.0

0.5.0 · 8 September 2026

PRs #32–#46 plus the post-merge review in dev_docs/pull_requests/2026/0.5.0-release-sweep/GROK_REVIEW.md.

Added

  • Opt-in catalogue product source. ProductSource with Legacy (the existing shop tables) and Catalogue adapters, switched by shop_product_source in phoenix_kit_shop_config. Default remains Legacy and fails closed when phoenix_kit_catalogue is not loaded. Catalogue items are projected into %Product{}/%Category{} view-structs so the storefront, cart and options never need to know which adapter is active. (#34)
  • Catalogue extension slot. Duck-typed catalogue_extensions/0 discovery, ItemCommerce/CategoryCommerce embedded schemas owning data["ecommerce"], and Shop section components for catalogue item and category forms. No hard PhoenixKitCatalogue dependency. (#32)
  • Storefront filters and variant picker on catalogue attribute sets. Facet filtering over attribute_set (with metadata_option as an alias), per-category storefront_filters overrides, per-language set/value labels, and the shopper’s language threaded into add-to-cart so translated price modifiers apply. (#35)
  • Per-domain currency. Carts freeze display currency, base currency and FX rate at creation; line prices snapshot through billing’s present/3 at that frozen rate; shipping thresholds compare in base; orders copy the same triple. Storefront LiveViews re-render on a rate change; checkout flags a stale frozen rate; compare_at converts the same way as the asking price. reprice_for_base_change/3 rewrites catalog amounts when the shop’s base currency changes (legacy source only; catalogue shops fail closed). (#33, #38, #39)
  • Shopify media, variants and collections. Images land in Storage; product options/variants become catalogue attribute sets; collections become categories with position. Runs as Oban jobs on shop_imports. (#36)
  • Shopify body_html is converted to Markdown at sync time, so the storefront Markdown renderer does not treat <p> blocks as opaque HTML. (#42)
  • Gated admin “Edit” links on storefront pages. Shop index, category and product pages call core’s AdminEditHelper.assign_admin_edit/3 (via a guarded maybe_assign_admin_edit/3, so an older host core without the helper degrades to no link) with permission: "shop". (#41, #46)
  • Product page layout. Two-column grid (gallery | buy box); description, body_html and specifications sit under the gallery; category navigation is a collapsed panel gated by shop_sidebar_show_categories. (#44, #46)

Fixed

  • Catalogue items no longer stamp "USD" by default. ItemCommerce and the Shop section prefill follow the shop’s base currency (blank if unset), matching the currency-hygiene contract from 0.4.3. (#32)
  • Catalogue listing order, counts and facets agree. Hidden-category filtering no longer uses DISTINCT ON (uuid) (which ordered the catalog by uuid); active_visibility/1 uses the same COALESCE as the listing; vendor counts and the price slider honour exclude_hidden_categories. (#34, #35)
  • Category option_schema price modifiers apply at add-to-cart under the catalogue source (reload now preloads :category). (#34, #35)
  • Tags stay visible on a non-canonical default dialect (en-GB vs the page’s en-US). Comparison is on language base, not dialect. (#40)
  • Guest-cart merge no longer copies display amounts across currencies. A leftover USD user cart plus a guest EUR cart restamps through base at the user cart’s frozen rate. (#33)
  • Checkout shipping eligibility uses the same base subtotal as listing, so a method excluded from the offer list cannot sneak through conversion on a non-base cart. (#33)
  • Open storefront tabs reload products after a base-currency reprice, so the page cannot show the old amount while add-to-cart charges the new one. (#38, #39)
  • Emptying a cart after the currency table is cleared no longer crashes on nil.code. (#33)
  • A product with no asking price no longer renders “100% OFF”. (#33)
  • Product-page admin Edit survives shop_show_cart_bar: false. The cross-language mount assigns :cart_count; add-to-cart updates the badge; on-request products no longer show × 0.00 = 0.00. (#41, #44, #46)
  • create_from_shopify/2 converts body_html to Markdown (the update path already did) and no longer raises on a junk variant price. (#36, #42)
  • Image-URL HEAD checks re-validate every redirect hop, matching GET. Invalid HTML numeric entities no longer crash Shopify check. A crash mid media-sync stamps finished_at so the button does not stay disabled. (#36, #42)

Changed

  • ⚠️ Dependency floors raised. phoenix_kit ~> 2.6 → ~> 2.15 (Cart/CartItem cast the base_currency/exchange_rate/ base_unit_price columns core’s currency-freeze migration adds; below it every cart write raises undefined_column) and phoenix_kit_billing ~> 0.7 → ~> 0.13 (Currency.present/3 with a frozen :rate, effective_rate/2, resolve_display_currency/1). A host pinned below either gets an unsolvable dependency set from mix deps.get. New runtime dependency mdex ~> 0.13 (Markdown rendering of synced descriptions). (#33, #38, #42)
  • Settings toggle and option rows sit on a plain flex layout instead of daisyUI label/fieldset-legend (which styled nothing under v5). (#37)
  • AGENTS.md follows the shared module skeleton; the lockfile is buildable against Hex again. (#43, #45)

E-commerce 0.5.0. Install or update: {:phoenix_kit_ecommerce, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.