Access and modify the shopping cart of the current visitor.
Methods
Invoke via \Components\Commerce\Carts\Current::method() Click a method name to copy it.
- `
void
addProduct($arrOptions)`
Adds a product to the shopping cart
product_id => The id of the product to add to the cart product_quantity => The quantity to add to the cart product_order_options_user => User selected options when ordering a product product_price => Price disable_merge => When true, if an identical product already exists in the cart, no merge will occur bought_for_contact_id => Allows the product to be linked to a different contact product_title => Used only if no product_id set product_sales_description => Sales invoice description ]
Parameters:
- $arrOptions
mixed
- `
void
addProducts($arrAllOptions)`
Adds products to the shopping cart
[ [ product_id => The id of the product to add to the cart product_quantity => The quantity to add to the cart product_order_options_user => User selected options when ordering a product product_price => Price disable_merge => When true, if an identical product already exists in the cart, no merge will occur bought_for_contact_id => Allows the product to be linked to a different contact product_title => Used only if no product_id set product_sales_description => Sales invoice description ], ... ]
longer one of the product's current option values. Defaults to false so public/untrusted callers keep dropping unrecognised input; only set true where the value is a stored one being round-tripped (e.g. editing an existing invoice whose product options have drifted).
Parameters:
- $iProductId
mixed
- $arrOrderOptionsPost
mixed
- $bKeepUnmatched
mixed
Return
array
- `
array
getAllDetailed()`
Returns the shopping cart as an array with the details of the products, calculated tax and shipping
Return
Products in shopping cart
- `
string
getComments()`
Returns any comments the customer may have on their order
Return
string
- `
int
getCount()`
Returns the number of item rows in the shopping cart
Return
Number of rows
- `
int
getCountProducts()`
Returns the total quantity of products in the shopping cart
Return
Number of products
- `
string
getCountry()`
Returns the country of the contact uses this cart
Return
string
- `
string
getCurrencyId()`
Returns the current currency id
Return
string
- `
array
getDiscounts()`
Returns an array of discounts for this order
Return
Discounts
- `
bool
getIsGuestCheckoutDisabled()`
Returns whether or not the 'guest checkout' option is disabled for cart.
This is derived from the products in the cart.
Return
bool
- `
bool
getIsShippingRequired()`
Returns whether shipping is required for the products currently in the cart
Return
bool
- `
void
getIsSubmittable()`
Returns whether the cart is submittable or not
- `
float
getOrderMinimumAmount()`
Retrieves the order minimum value as configured in the config item