CoolCMS API

UnpricedCartPreview
in package

FinalYes

Cart preview in which no priceable item is left.

Typical case: a cart of goods priced in CZK after switching to a region paid in EUR. The preview (OrderSnapshotBuilder::buildItems(), $strict = false) drops sets without a price in the order currency and returns them in unpricedSetIds. When all sets are dropped, the order has no items and the VAT engine has nothing to tax. Without this class the preview would fail with taxUnavailable and no order.unpricedItems; the front end could not tell the real reason and would show step 2 with no shipping.

Such a preview is returned as successful with empty options and the list of unpriced sets; the front end sends the customer back to the cart with a "cannot be bought in this currency" message. Pure decision without I/O, called by OrderCheckoutManager.

Table of Contents

Constants

NO_OPTIONS  : array<string|int, mixed> = ['shipping' => [], 'payment' => []]
Shipping and payment options for a cart without a priceable item: nothing to ship or pay.

Methods

isUnpricedOnly()  : bool
Returns true when the cart holds only sets without a price in the order currency.

Constants

NO_OPTIONS

Shipping and payment options for a cart without a priceable item: nothing to ship or pay.

public array<string|int, mixed> NO_OPTIONS = ['shipping' => [], 'payment' => []]

Methods

isUnpricedOnly()

Returns true when the cart holds only sets without a price in the order currency.

public static isUnpricedOnly(int $pricedItemCount, int $unpricedCount) : bool

An empty cart does not belong here (rejected earlier by emptyCart); a cart with at least one priceable item takes the normal path.

Parameters
$pricedItemCount : int
$unpricedCount : int
Return values
bool
On this page

Search results