Forum

Thread tagged as: Question, Shop

Adding template to perch_shop_order

Hi

I'm trying to add 'template' => 'my-template.html’ to;

<?php perch_shop_order(perch_get('orderID')); ?>

Looking at the docs, I thought;

<?php perch_shop_order($order_id, [
    'template' => 'orders/items.html'
]); ?>

would work, but in debug it doesn't show that the template is either being used or missing? Is it down to the way I'm getting the ID (orderID v $order_id)?

Wayne Hooper

Wayne Hooper 6 points

  • 3 years ago

Hi Wayne

This should work. Is there no path at all shown in your debug? This function defaults to the template at /shop/orders/order.html.

If you're taking the order ID from the URL then

<?php perch_shop_order(perch_get('orderID')); ?>

Does the same as

<?php perch_shop_order(perch_get('orderID'), [
'template' => 'shop/orders/order.html']
); ?>

Jon

Thanks Jon

Your example made me realise I was missing shop/ from my path to the template.

Regards Wayne

You're welcome!