API: Cart and Checkout
$padloper->getCart()
Gets the items in a customer's basket/cart.
// get items in customer cart
/** @var array $cartItems */
$cartItems = $padloper->getCart();
$out = "";
// loop through cartItems
foreach ($cartItems as $cartItem) {
/** @var stdClass $cartItem */
$out .=
"<span>Item Title: {$cartItem->pad_title}</span><br>" .
"<span>Item Quantity: {$cartItem->quantity}</span><br>" .
"<input type='hidden' value='{$cartItem->id}'>";
}
echo $out;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
WARNING
In this method, taxes are not yet calculated. For final prices with tax use $padloper->getOrderLineItems()
instead.
$padloper->renderCartPriceAndCurrency($amount)
Returns an amount (e.g. price) formatted per the shop's currency.
// format a price as per shop's currency
$formattedPrice = $padloper->renderCartPriceAndCurrency($price);
echo $formattedPrice;// e.g. 350,99 €
1
2
3
2
3
output: 350,99 €