
Handel::Cart::Item - Module representing an individual shopping cart line item

use Handel::Cart::Item;
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
$cart->add($item);

Handel::Cart::Item is used in two main ways. First, you can create new line items and add them to an existing cart object:
use Handel::Cart::Item;
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
$cart->add($item);
Second, the items method of any valid Handel::Cart object returns a collection of Handel::Cart::Item objects:
my @items = $cart->items;
foreach (@items) {
print $_->sku;
};

You can create a new Handel::Cart::Item object by calling the new method:
my $item = Handel::Cart::Item->new({
sku => '1234',
price => 1.23,
quantity => 1
});
$item->quantity(2);
print $item->total;
This is a lazy operation. No actual item record is created until the item object is passed into the add method of a Handel::Cart object.

Returns or sets the sku (stock keeping unit/part number) for the cart item.
Returns or sets the quantity the cart item.
Returns or sets the price for the cart item.
Starting in version 0.12, price now returns a stringified Handel::Currency object. This can be used to format the price, and convert its value from on currency to another.
Returns the total price for the cart item. This is really just quantity*total and is provided for convenience.
Starting in version 0.12, subtotal now returns a stringified Handel::Currency object. This can be used to format the price, and convert its value from on currency to another.
Returns or sets the description for the cart item.

Handel::Cart, Handel::Currency

Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/