Forum
different email templates for same status
Hello, can I check for a <perch:orderitem id="sku" />
inside an email template and render different content depending on the ordered product?
Hello, can I check for a <perch:orderitem id="sku" />
inside an email template and render different content depending on the ordered product?
You can use
perch:if
to test the value ofsku
but not much beyond that.This is not working as I would expect:
email template
I tested with different SKUs and always receive the
intro_1
. Is it justid="sku"
I should test against?Is
sku
available in that context? It's hard to say what's happening only seeing a tiny part of your template.The rest is pretty much the default
order_paid.html
.So later in the template the order item's info are being accessed with
perch:orderitem
.I understand that the ordered item's SKU is not an exception and should also be accessed with
<perch:orderitem id="sku" />
. But then I suppose I can't put this into aperch:if
right?You can, but only within that context. I suspect that's not going to achieve what you're after.
Yeah and it's not scalable anyway. So I'm investigating a different approach. I want to send a POST request to a Zapier endpoint with a payload of a json object holding the order information. This will then call the Sparkpost API and send the email using a template which can include logic.
An example request
What is not clear to me is when exactly I'll have to make the request.
Currently I have a checkout.php page where I call the
perch_shop_payment_form()
and the success.php where there is only some text for now. Do I have the order information available in php in any of these steps/pages?I hope the question makes some sense :)
I think I found it. I will try to do it in the success page with
perch_shop_order
for the order info and some members function for the member's info. All good for now, thanks!