0

we are using magento 2.1.9ce.

In the ordermails are now (by default shown) the name, sku, qty, price and the size attribute.

Now I would like to add a custom attribute to this. The name of the attribute is 'artikelnummer'. But only the parent product has this attribute.

How can I add this to the transactional e-mail? So it reads this attribute from the parent product

0

You can do it by observer for event email_order_set_template_vars_before which has sender and transport which is instance of Magento\Framework\DataObject.

In your observer find your attribute and then set it to transport by ->setData() method

| improve this answer | |
  • Thats sounds complicated .... I can do Some html and understand little php. Is that easy to do? – Ronny Jul 10 '18 at 11:14
  • Here is tutorial how to create observer in Magento webkul.com/blog/observers-in-magento2 in events.xml just put event name email_order_set_template_vars_before and the in execute() method something like: $transport = $observer->getTransport(); if(null !== $transport) { //Add here your code to get your custom attribute } – Marek Mularczyk Jul 11 '18 at 5:58

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.