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_ratepersisted as0on cart→order conversion.build_order_attrs/3hardcoded a0rate whiletax_amountwas 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 usesget_tax_rate(cart)(single source of truth). Pinned by an end-to-end regression test. unique_constraintnames forShippingMethod(:slug) andImportConfig(:name,:uuid) did not match the actual DB indexes, so duplicate inserts raisedEcto.ConstraintErrorinstead of returning{:error, changeset}. Pinned to the real index names.- No-billing tax fallback applied the configured
billing_default_tax_rateeven whenbilling_tax_enabledwasfalse; now gated on the enabled flag, matching thePhoenixKitBilling-loaded path. DialectMapper.resolve_dialect/2→/1after thephoenix_kitupgrade dropped the 2-arity form, restoring a clean--warnings-as-errorsbuild.
Added
PhoenixKitEcommerce.Activity— PII-safe LiveView-layer activity-logging wrapper aroundPhoenixKit.Activity. Logs admin mutations (products incl. bulk, categories, shipping methods, import configs/runs) and never crashes the caller (no-ops when core’sPhoenixKit.Activityis absent; rescues DB errors).PhoenixKitEcommerce.Errors— central gettext-backed mapping from error atoms to user-facing strings (PhoenixKitEcommerce.Gettextbackend). Wired into the:cart_not_activeand:unknown_formatpaths.- Test harness:
DataCase/LiveCase, test endpoint/router/layouts, schema viaPhoenixKit.Migration.ensure_current/2, and full schema/context/LiveView coverage (6 → 183 tests).
Changed
- Cap
include_keywords/exclude_keywords/exclude_phrasesimport 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>withassign_form/2) for inline validation errors. - Log a warning on
billing_default_tax_rateparse failure instead of silently falling back to0. - Refresh
mix.lockfor the upgradedphoenix_kitand 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.