Buffalo Eats Online API Documentation

CartService
in package

Session-based shopping cart service.

Manages cart items per business using session storage with dot notation. Each business has its own isolated cart namespace.

Tags
author

J.J. Johnson visionquest716@gmail.com

copyright

2026 VisionQuestServices LLC

Table of Contents

Methods

add()  : bool
Add an item to the cart.
calculateTotals()  : array<string|int, mixed>
Calculate cart totals (subtotal, tax, total) with optional discount.
clear()  : void
Clear all items from the cart for a business.
getCount()  : int
Get total item count in the cart for a business.
getItems()  : array<string|int, mixed>
Get all cart items for a business.
remove()  : void
Remove an item from the cart.
update()  : void
Update quantity of a cart item.

Methods

add()

Add an item to the cart.

public add(int $businessId, int $itemId, int|null $variantId[, int $quantity = 1 ][, array<string|int, mixed> $selectedModifierIds = [] ]) : bool
Parameters
$businessId : int

Business ID

$itemId : int

Menu item ID

$variantId : int|null

Variant ID (null for base item)

$quantity : int = 1

Quantity to add

$selectedModifierIds : array<string|int, mixed> = []

Array of modifier IDs

Return values
bool

calculateTotals()

Calculate cart totals (subtotal, tax, total) with optional discount.

public calculateTotals(int $businessId[, float $taxRate = 0.0 ][, float $discount = 0.0 ]) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

$taxRate : float = 0.0

Tax rate as decimal (e.g., 0.08 for 8%)

$discount : float = 0.0

Coupon discount amount to subtract from subtotal before tax

Return values
array<string|int, mixed>

With keys: subtotal, tax, total, discount, items

clear()

Clear all items from the cart for a business.

public clear(int $businessId) : void
Parameters
$businessId : int

Business ID

getCount()

Get total item count in the cart for a business.

public getCount(int $businessId) : int
Parameters
$businessId : int

Business ID

Return values
int

getItems()

Get all cart items for a business.

public getItems(int $businessId) : array<string|int, mixed>
Parameters
$businessId : int

Business ID

Return values
array<string|int, mixed>

Associative array keyed by cart key

remove()

Remove an item from the cart.

public remove(int $businessId, string $cartKey) : void
Parameters
$businessId : int

Business ID

$cartKey : string

Cart item key (itemId-variantId)

update()

Update quantity of a cart item.

public update(int $businessId, string $cartKey, int $quantity) : void
Parameters
$businessId : int

Business ID

$cartKey : string

Cart item key

$quantity : int

New quantity


        
On this page

Search results