E-commerce 0.12.0: Refunds that return stock, low-stock reminders and Only N left
E-commerce 0.12.0 finishes stock tracking in the PhoenixKit shop: you choose what a refund does to stock, staff get a reminder when an item runs low, and the product page shows when an item is sold out or nearly so.
What a refund does to stock
A new setting on the shop settings page, When a paid order is refunded, decides what happens when a paid order whose goods were written off is fully refunded. Tell the warehouse keeper (the default) sends the shop’s operators and warehouse keepers one notification naming the goods, with a link to the goods receipts. Put the goods back in stock posts one goods receipt that returns the same quantities to the warehouse they came from, linked to the order. A refund doesn’t say whether the goods came back, which is why notifying is the default. An order that was short of stock when it was paid always notifies, and so does a receipt the Warehouse module refuses.
The two new stock settings.
Low-stock reminder
When a sale takes an item to or below its minimum in the Warehouse module, the same people get one notification, starting “Low stock:”, with what is on hand and the minimum. It is sent once each time the item crosses the minimum. Both new notifications belong to the “Stock problems” notification type.
Sold out and Only N left
While stock tracking counts an item, a sold-out product shows a disabled Out of stock button instead of Add to Cart. With Show how many are left at or below set above 0, the product page also says how many are left, for example Only 3 left, when stock is at or below that number. An open product page updates when a sale or a return changes the stock.
With 3 on hand and the threshold at 5, the product page says how many are left.
Upgrading
E-commerce 0.12 needs PhoenixKit 3.5 or later: update core first. There is no migration. The new settings start safe: a refund only notifies, and the “Only N left” line is off until you set a number.
Full release notes: E-commerce 0.12.0
0.12.0 · 15 November 2026
The rest of stock tracking (#82): what a refund does to stock, a low-stock reminder, and a product page that shows when an item is sold out or nearly so. PhoenixKit core 3.5.0 is now the minimum.
Upgrading. The phoenix_kit requirement is now >= 3.5.0 and < 4.0.0
(it was >= 2.65.0). A host on an older core must update core first. There is
no migration. The two new settings start at their safe defaults: a refund only
notifies, and “Only N left” is off.
Added
- What a refund does to stock, under When a paid order is refunded on
the shop settings page (
shop_stock_refund_action). A full refund of a paid shop order whose sale was written off either notifies the shop’s operators and warehouse keepers once ("notify", the default), or puts the same quantities back at the warehouse they came from with one goods receipt ("receipt"). The receipt is linked to the order, and itsexternal_refof<order number>/returnstops a retried event from posting it twice. A refund does not say whether the goods came back, so notifying is the default. A receipt Warehouse refuses notifies instead of retrying. An order that was short of stock when paid always notifies. A refund that lands while the sale is still being written off is handled once, by whichever delivery comes second. - A low-stock reminder: a write-off that takes an item to or below its
Warehouse minimum sends one
shop.stock_lownotification, once per crossing. - Sold out and “Only N left” on the product page. While stock tracking
counts an item, a sold-out one shows a disabled Out of stock button.
Only N left shows when N is at or below
shop_stock_low_threshold(Show how many are left at or below, default0, never). An open product page updates when a write-off or a return changes the stock. Availability.offer/1answers:available,{:few_left, n}or:sold_out.- The “Stock problems” notification type now also covers
shop.order_refunded_stockandshop.stock_low.
Changed
phoenix_kit>= 3.5.0 and < 4.0.0. The code paths for older cores are gone: the API tools, the rate limit, the batch confirmation threshold and the canonical links now call core 3.5’s functions directly.
Fixed
- A host without the optional
phoenix_kit_aipackage can compile the shop again. The product form’s AI translation setup was expanded even when the package was missing, so compilation failed withmodule ...AITranslate.Embed is not loaded.
E-commerce 0.12.0. Install or update: {:phoenix_kit_ecommerce, "~> 0.12"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.