Removing SKU from Magento Order Emails
When it comes to customizing order emails in Magento, you have a high degree of control over the content that is sent to your customers. If you find that the product’s SKU appears in your default order email template and you’d like to remove this information, I’ll guide you through the process.
Understanding the Default Order Email Template
Firstly, let me clarify where the SKU originates from in the default Magento setup. The sales_email_order_items_template file within the email directory of your theme is responsible for generating the items table in your order emails. This template includes the product’s name and SKU by default.
Customizing Your Order Email Template
To remove the SKU, we need to create a copy of this template file and modify it according to our requirements. Here are the steps:
-
Navigate to
app/design/frontend/{your_package}/{your_theme}/template/email/sales/in your Magento directory. -
Create a new folder named
orderif it doesn’t already exist. -
Inside the
orderfolder, create a file calleditems.phtml. -
Copy the contents of your default
items.phtml(which is located atapp/design/frontend/base/default/template/email/sales/order/) and paste them into your newitems.phtmlfile. -
Open this new
items.phtmlfile in a text editor. You’ll see that each item’s details are enclosed within a<tr>tag. -
Look for the code snippet responsible for rendering the SKU:
<td class="item-sku"><?php echo $this->escapeHtml($item->getSku()) ?></td> -
Comment out or delete this line to prevent the SKU from being displayed in your order email.
Configuring Magento to Use Your Custom Email Template
After you’ve modified the items.phtml file, you need to tell Magento to use this custom template for sending order emails:
-
Navigate to Stores > Configuration > Sales > Sales Emails.
-
Under ‘Order’, find the setting for “Items Order” and set it to “Custom”.
-
Click on “Load Custom Design”.
-
In the provided field, enter
order_itemsas the template name. -
Save your configuration changes by clicking on “Save Config”.
Testing Your Changes
To verify that the SKU has been successfully removed from your order email:
-
Place a new test order on your store’s frontend.
-
Check your inbox for the order confirmation email.
-
Open the email and look at the items tableâthe SKU should no longer be visible!
Remember, it’s always recommended to work with a backup of your files when making changes like this. If you face any issues or need further assistance, feel free to reach out to our technical support team at Laravel Company.
In conclusion, by following these steps and understanding the structure of Magento’s email templates, you can easily customize order emails to meet your specific business needs.