Orchestrates a Shopify → local product sync: fetch, diff, and selectively apply confirmed changes.
This is the domain layer only — no LiveView/UI wiring here (see
PhoenixKitEcommerce.Shopify.Provider moduledoc for why "Test Connection"
doesn't exercise this; that's this module's job instead, via check/1).
Summary
Functions
Applies fields from change to its product.
Applies fields to every change in changes, partitioning them by outcome.
Fetches Shopify products for integration_uuid, diffs them against the
local catalog, and returns the list of changes an operator can review.
Functions
@spec apply_change( PhoenixKitEcommerce.Shopify.ProductDiff.Change.t(), :all | [atom()] ) :: {:ok, PhoenixKitEcommerce.Product.t()} | {:error, Ecto.Changeset.t()}
Applies fields from change to its product.
fields is :all (every field in change.changes) or an explicit list
of field atoms — only fields present in BOTH change.changes and
fields are written, everything else on the product is left untouched.
Localized fields (title, body_html, description) are merged into
the base locale only; other languages already on the product are
preserved.
@spec apply_changes( [PhoenixKitEcommerce.Shopify.ProductDiff.Change.t()], :all | [atom()] ) :: %{ succeeded: [PhoenixKitEcommerce.Shopify.ProductDiff.Change.t()], failed: [PhoenixKitEcommerce.Shopify.ProductDiff.Change.t()] }
Applies fields to every change in changes, partitioning them by outcome.
A changeset failure on one product doesn't stop the rest from being
attempted. Returns %{succeeded: [Change.t()], failed: [Change.t()]},
each preserving the input order — so a caller can drop succeeded and
keep offering failed for retry instead of reporting them as done.
@spec check(String.t()) :: {:ok, [PhoenixKitEcommerce.Shopify.ProductDiff.Change.t()]} | {:error, term()}
Fetches Shopify products for integration_uuid, diffs them against the
local catalog, and returns the list of changes an operator can review.