PhoenixKitEcommerce.Catalogue.CategoryCommerce (PhoenixKitEcommerce v0.5.0)

Copy Markdown View Source

Embedded schema for the shop fields a catalogue category stores under category.data["ecommerce"]. See PhoenixKitEcommerce.Catalogue.ItemCommerce moduledoc for the discovery contract this namespace is reached through.

Summary

Functions

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

Types

t()

@type t() :: %PhoenixKitEcommerce.Catalogue.CategoryCommerce{
  featured_item_uuid: term(),
  image_uuid: term(),
  option_schema: term(),
  shop_status: term(),
  storefront_filters: term()
}

Functions

cast(params, current)

@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) or {:error, [{field, message}]}.

changeset(struct, attrs)

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

Changeset — option_schema reuses PhoenixKitEcommerce.OptionTypes.validate_options/1.