Customize emails based on the shipping method
How to show different content in your transactional emails depending on the shipping method, such as shipping vs. pickup in store.
In Shoporama, you have different templates for your transactional emails. Sometimes it makes sense to customize the email text based on the shipping method the customer chose, for example if the customer picked "Pickup in store" instead of delivery.
Why customize emails by shipping method?
Imagine that a customer has chosen "Pickup in store" as the shipping method. When you mark the order as shipped, the customer receives an email saying "Your order has been shipped". But that doesn't make sense, because the customer is picking up the order in person.
By customizing the email, you can write "Your order is ready for pickup" to customers who chose pickup instead, and keep the normal text for other shipping methods.
Do you use Design → Emails?
This guide is about the theme's email templates. If you have published a setup for the email under Design → Emails and it is active, the email is built from the editor's blocks and does not use the theme's template. An if statement in order_sent.html is then not included in the email. If the text should depend on the shipping method, add the Code block in the editor and write the same if statement there. The block requires that your role has access to Code. If the email is sent from the theme because it has no active setup, you edit the template as described below. Read more in Email editor: customize your automated store emails without code.
1. Find the shipping method ID
First, you need to find the ID of the shipping method you want to target. Do the following:
- Go to Delivery → Shipping methods
- Click Edit next to the shipping option you want to work with
- Look at the URL in your browser. It ends with a number, such as /shipping/edit/7664
- Write down this number. It's the shipping method ID
2. Customize the email template
Now edit the relevant email template. For the "order shipped" email, it's the file order_sent.html in your theme.

Add an if statement that checks the shipping method ID:
<{if $order}>
<{$shipping = $order->getShipping()}>
<{if $shipping->getShippingId() == 7664}>
<p>Your order is ready for pickup!</p>
<p>Stop by the store during our opening hours.</p>
<{else}>
<p>Your order is on its way!</p>
<p>You will receive a tracking email shortly.</p>
<{/if}>
<{/if}>
Important
Remember to change 7664 to the ID you found in step 1. You can add more elseif blocks if you have several shipping methods with different texts.
3. Variables available in email templates
In email templates, you have access to the order and all its data. These are the most useful:
| Variable | Description |
|---|---|
| $order | The order object |
| $order->getShipping() | The shipping method on the order |
| $shipping->getShippingId() | The shipping method ID |
| $shipping->getName() | The shipping method name (such as "PostNord") |
| $order->getTrackingNumber() | The tracking number |
4. Examples of advanced customization
You can also use the shipping method name instead of the ID, if you prefer:
<{$shipping = $order->getShipping()}>
<{if $shipping->getName()|strstr:'pickup'}>
<p>Your order is ready for pickup</p>
<{elseif $shipping->getName()|strstr:'parcel shop'}>
<p>Your order has been sent to your chosen parcel shop</p>
<{else}>
<p>Your order has been shipped with <{$shipping->getName()}></p>
<{/if}>
Tip
You can customize all email templates this way, not just order_sent.html. For example, you can also customize the order confirmation (invoice.html) with delivery information based on the shipping method.
How to edit the email templates
The email templates are in your theme's templates/mails/ folder. You can edit them via:
- The Code editor: directly in the Shoporama admin under Design → Code editor
- SFTP: download the files and edit them in your preferred program (requires a Pro subscription)
Need help customizing your emails? Contact us at support@shoporama.dk.
Related articles
Unsubscribe links in automated emails
Let your customers unsubscribe from automated emails, such as follow-ups after purchase and product review requests, with a single link in the email.
Customize the content of your automatic emails
How to customize the automatic emails your Shoporama store sends: without code under Design > Emails, with subject lines and texts in the store...
Which emails does Shoporama send to my customers?
An overview of the automatic emails Shoporama sends to your customers: order confirmation, shipping confirmation, abandoned cart, product reviews,...
Related features
Full design freedom: your design, your rules
Design your online store freely with full access to HTML, CSS, and templates. Use ready-made themes, the drag-and-drop Page designer, or build from...
Shipping options
Set up shipping with PostNord, GLS, DAO, DHL, and Shipmondo. Parcel shops at checkout, tracking, free shipping, and weight-based shipping calculation.