# `PhoenixKitEcommerce.Catalogue.ItemCommerce`
[🔗](https://github.com/BeamLabEU/phoenix_kit_ecommerce/blob/0.5.10/lib/phoenix_kit_ecommerce/catalogue/item_commerce.ex#L1)

Embedded schema for the shop fields a catalogue item stores under
`item.data["ecommerce"]`.

Catalogue owns the item and never validates or renders this namespace —
that is this module's job, reached only through
`PhoenixKitEcommerce.Catalogue.Extension` (see its moduledoc for the
discovery contract). Validations mirror `PhoenixKitEcommerce.Product`'s
changeset for the fields the two share.

# `t`

```elixir
@type t() :: %PhoenixKitEcommerce.Catalogue.ItemCommerce{
  compare_at_price: term(),
  cost_per_item: term(),
  currency: term(),
  download_expiry_days: term(),
  download_limit: term(),
  file_uuid: term(),
  legacy_product_uuid: term(),
  made_to_order: term(),
  price_from: term(),
  price_modifiers: term(),
  price_on_request: term(),
  price_unit: term(),
  product_type: term(),
  requires_shipping: term(),
  shop_status: term(),
  shopify: term(),
  tags: term(),
  taxable: term(),
  translation_fingerprints: term(),
  vendor: term(),
  weight_grams: term()
}
```

# `cast`

```elixir
@spec cast(map() | nil, map() | nil) ::
  {:ok, map()} | {:error, [{atom(), String.t()}]}
```

Merges `params` (submitted form/API values, or `nil`) over `current`
(the existing `data["ecommerce"]` map, or `nil`) and validates the
result.

Returns `{:ok, map}` with the full resulting namespace — defaults
included, decimals rendered as strings so the map stays JSON-safe for
JSONB storage — or `{:error, [{field, message}]}`.

# `changeset`

```elixir
@spec changeset(t(), map()) :: Ecto.Changeset.t()
```

Changeset — same validations as `PhoenixKitEcommerce.Product.changeset/2`
for the fields the two share.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
