2

When an order is submitted on the Craft Commerce website I'm currently building, an email is automatically sent to the customer. Inside this email is a link to download an invoice for that specific order.

I had accomplished this by putting the following link into my emails

<a href="{{ siteUrl }}index.php/admin/actions/commerce/downloads/pdf?number={{ order.number }}">Download your invoice</a>

It's not ideal as you could actually download any invoice by changing the order.number, but we fixed that by using a url proxy.

But I realised a few minutes ago that this link is not public and requires a login. Which I don't want. Is there any way to generate a public link for the invoice?

1

You could write a simple plugin, that exposed an anonymous controller action that mimicked Commerce's Commerce_DownloadsController's actionPdf() method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.