Merx

Sending Emails

You may want to send a confirmation mail to your customer. You can use hooks to send mails. Read Kirby’s guide about emails to learn more of its power.

site/config.php

function sendConfirmationMail($orderPage) {
  kirby()->email([
    'from' => 'info@my-shop.com',
    'to' => (string)$orderPage->email(),
    'subject' => 'Thank’s for your order!',
    'body'=> 'Dear ' . $orderPage->name() . ', you have paid ' . formatPrice($orderPage->cart()->getSum()),
  ]);
}

return [
  'hooks' => [
    'ww.merx.completePayment:after' => function ($orderPage) {
      sendConfirmationMail($orderPage);
    },
  ],
];