Shipping rates fetched from Printify during product sync, converted to GBP at sync time using frankfurter.app ECB exchange rates with 5% buffer. Cached in shipping_rates table per blueprint/provider/country. Cart page shows shipping estimate with country selector (detected from Accept-Language header, persisted in cookie). Stripe Checkout includes shipping_options for UK domestic and international delivery. Order shipping_cost extracted from Stripe on payment. ScheduledSyncWorker runs every 6 hours via Oban cron to keep rates and exchange rates fresh. REST_OF_THE_WORLD fallback covers unlisted countries. 780 tests, 0 failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
437 B
Elixir
20 lines
437 B
Elixir
defmodule SimpleshopThemeWeb.Shop.Cart do
|
|
use SimpleshopThemeWeb, :live_view
|
|
|
|
alias SimpleshopTheme.Cart
|
|
|
|
@impl true
|
|
def mount(_params, _session, socket) do
|
|
{:ok, assign(socket, page_title: "Cart")}
|
|
end
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
assigns = assign(assigns, :cart_page_subtotal, Cart.calculate_subtotal(assigns.cart_items))
|
|
|
|
~H"""
|
|
<SimpleshopThemeWeb.PageTemplates.cart {assigns} />
|
|
"""
|
|
end
|
|
end
|