perch_shop_order()

Display the details of a single order, for the logged in customer with perch_shop_order().

Requires

Parameters

Type Description
Integer ID of the item to show
Array Options array, see table below
Boolean Set to true to have the value returned instead of echoed.

Options array

Name Value
template The name of a template to use to display the content.
skip-template True or false. Bypass template processing and return the content in an associative array.
return-html True or false. For use with skip-template. Adds the HTML onto the end of the returned array with key html.
raw True or false. Returns unprocessed content, for use alongside skip-template.

Usage examples

Display the order with the default template. The default template is shop/orders/order.html.

perch_shop_order($order_id);

This function accepts an array of options to control what is returned. It can be used as follows.

perch_shop_order($order_id, [
    'template' => 'my-template.html'
]);

After payment I want to get the ID of the order just made and show the details.

$order_id = perch_shop_successful_order_id();
perch_shop_order($order_id, [
  'template' => 'successful-payment-template.html'
]);