API: Session Order
$padloper->getOrder()
Get the current session's created order. This is available immediately the order is confirmed.
INFO
This includes the orders calculated details as per customer's cart and details, i.e. taxes, shipping and handling, etc.
/** @var WireData $order */
$order = $padloper->getOrder();
echo $order->date;
echo $order->modified;
echo $order->pageID;// $oder->id
// ** order id **
// order ID that can be customised with suffix/prefix.
// Different from pageID (the ProcessWire order page ID)
echo $order->orderID;
// ** order paid date **
echo $order->paidDate;
// ** payment method **
// e.g. Invoice or PayPal
echo $order->paymentMethod;
// 2. DISCOUNTS
// ** type **
// none|fixed|percentage
echo $order->discountType;
// ** value **
echo $order->discountValue;
// ** amount **
echo $order->discountAmount;
// 3. SHIPPING
// ** handling fee type **
// none|fixed|percentage
echo $order->handlingFeeType ;
// ** handling fee value **
echo $order->handlingFeeValue;
// ** handling fee amount **
echo $order->handlingFeeAmount;
// ** shipping amount **
echo $order->shippingFee;
// ** is custom handling fee **
// @note: only for manual orders
echo $order->isCustomShippingFee;
// 4. TOTALS
// total price of order including taxes and shipping and minus discounts
echo $order->totalPrice;
// 5. STATUSES
echo $order->status;
// @note: includes 'shipment status'
echo $order->fulfilmentStatus;
echo $order->paymentStatus;
// 6. TAXES
// ** is charge taxes manual exemption **
// @note: to identify whether tax exemption was applied to the whole order for a manual order
echo $order->isChargeTaxesManualExemption;
// ** is prices include taxes **
// @note: to identify whether at the time the order was placed, prices included taxes
echo $order->isPricesIncludeTaxes;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Aliases: TBD
WARNING
This does not include the order (line) items. See $padloper->getOrderLineItems() for that. It also does not include the order page itself.
$padloper->getOrderLineItems()
Get the line items in the current session's created order. This is available immediately the order is confirmed.
INFO
This includes calculated values for each line item including tax (taking into account product category tax overrides applicable to shipping country), whether the product is taxable and discounts.
/** @var WireArray $orderLineItems */
$orderLineItems = $padloper->getOrderLineItems();
foreach ($orderLineItems as $orderLineItem) {
/** @var WireData $orderLineItem */
// 1. PRODUCT
echo $orderLineItem->productID;
echo $orderLineItem->productTitle;
echo $orderLineItem->productSKU;
echo $orderLineItem->quantity;
echo $orderLineItem->isVariant;
// 2. DISCOUNTS
$discountType;
echo $orderLineItem->discountValue;
// @note: calculated based on discount type and value, unit price and quantity
echo $orderLineItem->discountAmount;
// 3. TAXES
echo $orderLineItem->taxName;
echo $orderLineItem->taxPercentage;
echo $orderLineItem->taxAmountTotal;
echo $orderLineItem->isTaxOverride;
// 4. UNITS
// @note: at the time the line item is created,
// the TRUE price of the product is set which takes into account
// whether the price 'is inclusive or exclusive of taxes'
echo $orderLineItem->unitPrice;
echo $orderLineItem->unitPriceWithTax;
echo $orderLineItem->unitPriceDiscounted;
echo $orderLineItem->unitPriceDiscountedWithTax;
// 5. TOTALS
echo $orderLineItem->totalPrice;
echo $orderLineItem->totalPriceWithTax;
echo $orderLineItem->totalPriceDiscounted;
echo $orderLineItem->totalPriceDiscountedWithTax;
// @note: this sums the line item's discount and the whole order discount
echo $orderLineItem->totalDiscounts;
// 6. SHIPMENT
echo $orderLineItem->deliveredDate;
// 7. STATUSES
echo $orderLineItem->status;
echo $orderLineItem->fulfilmentStatus;
echo $orderLineItem->paymentStatus;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Aliases: TBD
$padloper->getOrderCustomer()
Get the customer details in the current session's created order. This is available immediately the order is confirmed.
/** @var WireData $order */
$orderCustomer = $padloper->getOrderCustomer();
echo $orderCustomer->firstName;
echo $orderCustomer->middleName;
echo $orderCustomer->lastName;
echo $orderCustomer->email;
echo $orderCustomer->isTaxExempt;
// PRIMARY ADDRESS
echo $orderCustomer->shippingAddressFirstName;
echo $orderCustomer->shippingAddressMiddleName;
echo $orderCustomer->shippingAddressLastName;
echo $orderCustomer->shippingAddressPhone;
echo $orderCustomer->shippingAddressCompany;
echo $orderCustomer->shippingAddressLineOne;
echo $orderCustomer->shippingAddressLineTwo;
echo $orderCustomer->shippingAddressCity;
echo $orderCustomer->shippingAddressRegion;
echo $orderCustomer->shippingAddressCountry;
// @note: 'zip code'
echo $orderCustomer->shippingAddressPostalCode;
// BILLING ADDRESS
echo $orderCustomer->useBillingAddress;
echo $orderCustomer->billingAddressFirstName;
echo $orderCustomer->billingAddressMiddleName;
echo $orderCustomer->billingAddressLastName;
echo $orderCustomer->billingAddressPhone;
echo $orderCustomer->billingAddressCompany;
echo $orderCustomer->billingAddressLineOne;
echo $orderCustomer->billingAddressLineTwo;
echo $orderCustomer->billingAddressCity;
echo $orderCustomer->billingAddressRegion;
echo $orderCustomer->billingAddressCountry;
// @note: 'zip code'
echo $orderCustomer->billingAddressPostalCode;
// OTHER DATA
echo $orderCustomer->ipAddress;
// only if user is logged in
echo $orderCustomer->userID;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
WARNING
The specific customer information that is captured depends on your checkout form.
$padloper->getOrderTotalAmount()
Gets the session's order total amount (value) excluding taxes or shipping.
/** @var float $subtotal */
$subtotal = $padloper->getOrderTotalAmount();
2
$padloper->getOrderTaxTotals()
Get tax totals for given order line items including the short names of the respective taxes.
/** @var WireArray $orderLineItems */
$orderLineItems = $padloper->getOrderLineItems();
/** @var array $orderTaxTotals */
$orderTaxTotals = $padloper->getOrderTaxTotals($orderLineItems);
foreach ($orderTaxTotals as $taxShortName => $taxValue) {
echo "<span>{$taxShortName}: </span><span>" . $padloper->renderCartPriceAndCurrency($taxValue) . "</span><br>";
}
2
3
4
5
6
7