The shopping cart.
Mutating calls return the updated cart, as the API does.
In Picnic's model the cart is an order — the payload comes back as
"type" => "ORDER" with the same line items a placed order has — which is
why every call here returns an order-shaped document.
Summary
Functions
Adds a product. Options: :count (default 1), :as, plus request options.
Empties the cart.
Fetches the current cart. Pass as: :struct to decode into a
Picnic.Schema.Cart.
Removes a product. Options: :count (default 1), :as, plus request options.
Types
@type result() :: {:ok, term()} | {:error, Picnic.Error.t()}
Functions
@spec add(Picnic.Client.t(), String.t(), keyword()) :: result()
Adds a product. Options: :count (default 1), :as, plus request options.
@spec clear( Picnic.Client.t(), keyword() ) :: result()
Empties the cart.
@spec get( Picnic.Client.t(), keyword() ) :: result()
Fetches the current cart. Pass as: :struct to decode into a
Picnic.Schema.Cart.
@spec remove(Picnic.Client.t(), String.t(), keyword()) :: result()
Removes a product. Options: :count (default 1), :as, plus request options.