shopp_cart_item()

get an object representing the item in the cart.

shopp_cart_item ( $item )

@param int|string $item the integer index of the item in the cart, string 'recent-cartitem' for last added cart item
@return stdClass object with quantity, product id, variant id, and list of addons of the item.

Description

get an object representing the item in the cart.

Example

$Product = shopp_product('My Product', 'name');

// Add 1 My Product to the cart
shopp_add_cart_product($Product->id, 1);

$Product = shopp_product('My Product 2', 'name');

// Add 1 My Product 2 to the cart
shopp_add_cart_product($Product->id, 1);

// get the most recently added item (My Product 2)
$Item = shopp_cart_item('recent-cartitem');

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar