Skip to content

E-commerce 0.1.6: Orders keep their real tax rate

E-commerce 0.1.6 fixes the tax rate saved on orders. Every order made from a cart was stored with a 0% rate, although its tax amount was right. New orders now record the rate that was used.

Fixes

  • Tax rate on orders. Receipts, tax reports and refunds that work out the percentage from the order saw 0%. New orders take the rate from the same place as the tax amount. Orders placed before the update keep their stored 0.
  • Tax turned off. Without the Billing module loaded, the shop applied the default tax rate even when tax was turned off in the settings. The rate now only applies while tax is turned on. A default rate that cannot be read as a number is logged as a warning instead of quietly becoming 0.
  • Duplicates. Saving a shipping method with a slug that is already used, or an import configuration with a name that is already used, is now reported as a validation error instead of raising a database error.

Also new

Changes made in the shop admin are now written to the PhoenixKit activity log: products, including bulk actions, categories, shipping methods, import configurations and import runs. Logging never stops the change itself. Import filter lists (keywords to include or exclude, phrases to exclude) are limited to 100 entries each, with a form error above that. The shipping method form shows its errors next to the field.

Full release notes: E-commerce 0.1.6

0.1.6 · 4 June 2026

Fixed

  • Order tax_rate persisted as 0 on cart→order conversion. build_order_attrs/3 hardcoded a 0 rate while tax_amount was computed from the live rate, so every order recorded a 0% rate — breaking receipts, tax reports, and refund math that derive the percentage from the order. Now uses get_tax_rate(cart) (single source of truth). Pinned by an end-to-end regression test.
  • unique_constraint names for ShippingMethod (:slug) and ImportConfig (:name, :uuid) did not match the actual DB indexes, so duplicate inserts raised Ecto.ConstraintError instead of returning {:error, changeset}. Pinned to the real index names.
  • No-billing tax fallback applied the configured billing_default_tax_rate even when billing_tax_enabled was false; now gated on the enabled flag, matching the PhoenixKitBilling-loaded path.
  • DialectMapper.resolve_dialect/2 → /1 after the phoenix_kit upgrade dropped the 2-arity form, restoring a clean --warnings-as-errors build.

Added

  • PhoenixKitEcommerce.Activity — PII-safe LiveView-layer activity-logging wrapper around PhoenixKit.Activity. Logs admin mutations (products incl. bulk, categories, shipping methods, import configs/runs) and never crashes the caller (no-ops when core’s PhoenixKit.Activity is absent; rescues DB errors).
  • PhoenixKitEcommerce.Errors — central gettext-backed mapping from error atoms to user-facing strings (PhoenixKitEcommerce.Gettext backend). Wired into the :cart_not_active and :unknown_format paths.
  • Test harness: DataCase/LiveCase, test endpoint/router/layouts, schema via PhoenixKit.Migration.ensure_current/2, and full schema/context/LiveView coverage (6 → 183 tests).

Changed

  • Cap include_keywords/exclude_keywords/exclude_phrases import filters at 100 entries each with a friendly changeset error (was unbounded).
  • Centralize the nil-currency $ fallback as a single documented module attribute.
  • Migrate the shipping-method form to core components (<.input>/<.select>/<.textarea> with assign_form/2) for inline validation errors.
  • Log a warning on billing_default_tax_rate parse failure instead of silently falling back to 0.
  • Refresh mix.lock for the upgraded phoenix_kit and related dependencies.

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