Forum
Perch Shop Orders
Hi,
Is there any way to check if perch shop orders exist?
On our profile page we want to show the customers orders, but if none exist just display a message like "You have no orders yet".
I figure we could use some conditional statement like:
if perch_orders() {
perch_shop_orders()
else {
echo "You have no orders yet";
}
We know the above won't work, but wondered if there was a function to test if there are any orders to return, or check if the order count is above zero?
Thanks, Alex
As is possible with many other Perch functions, you would have to use the
perch_shop_orders()
optionskip-template
, save the output in a variable, inspect that variable for any returned data and then run yourif
statement.perch_shop_orders()
will be empty if there are no orders, therefore you can justThank you Robert,
That worked great!
In case it's useful to anyone, this is my final code on the profile (php) page: