I was trying to link the product name in the shipment mail to the product on our page, so the customer can click on the product name in the shipment mail.

I have tried with


but getProduct() returns null. The same code worked for the order confirmation mail.

Does anybody know how I can get the product URL?


2 Answers 2


Try this code :-

    $_item = $block->getItem(); 
    $product_key = $_item->getProduct()->getUrlKey();    
    echo $product_key;

More information :-

How to get "product url" for multi website in sales email template


  • Hello @whiterabbit this answer helpful or not ??? Commented Apr 24, 2020 at 12:10
  • Hi, so I already tried this one, but it doesn't work for shipping or creditmemo mails. It only works for confirmation mails, because $_item->getProduct() returns null for shipping and creditmemo mails. Commented Apr 28, 2020 at 11:57

You need to use $_item->getOrderItem()->getProduct() in Shipment & Credit Memo email templates.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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