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?



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


| improve this answer | |
  • Hello @whiterabbit this answer helpful or not ??? – Mohit Patel Apr 24 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. – whiterabbit Apr 28 at 11:57

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.