class CartItemOptionValue implements Arrayable, Jsonable

Properties

int|string $id

The ID of the cart item option value.

string $name

The name of the cart item option value.

int|float $qty

The quantity for this cart item option value.

float $price

The price of the cart item option value.

Methods

__construct(int|string $id, string $name, float $price)

CartItem constructor.

string
price()

Returns the formatted price of this cart item option value

string
subtotal()

Returns the subtotal.

setQuantity(int|float $qty)

Set the quantity for this cart item.

void
updateFromArray(array $attributes)

Update the cart item option value from an array.

fromArray(array $attributes)

Create a new instance from the given array.

array
toArray()

Get the instance as an array.

string
toJson(int $options = 0)

Convert the object to its JSON representation.

Details

at line 47
__construct(int|string $id, string $name, float $price)

CartItem constructor.

Parameters

int|string $id
string $name
float $price

at line 69
string price()

Returns the formatted price of this cart item option value

Return Value

string

at line 80
string subtotal()

Returns the subtotal.

Subtotal is price for whole CartItem with options

Return Value

string

at line 90
setQuantity(int|float $qty)

Set the quantity for this cart item.

Parameters

int|float $qty

at line 105
void updateFromArray(array $attributes)

Update the cart item option value from an array.

Parameters

array $attributes

Return Value

void

at line 120
static CartItemOptionValue fromArray(array $attributes)

Create a new instance from the given array.

Parameters

array $attributes

Return Value

CartItemOptionValue

at line 138
array toArray()

Get the instance as an array.

Return Value

array

at line 155
string toJson(int $options = 0)

Convert the object to its JSON representation.

Parameters

int $options

Return Value

string