{"id":19710,"date":"2025-07-29T16:54:54","date_gmt":"2025-07-29T11:24:54","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/?p=19710"},"modified":"2025-07-29T16:54:56","modified_gmt":"2025-07-29T11:24:56","slug":"call-to-undefined-method-in-the-magento-framework-phrase-gettracking","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/call-to-undefined-method-in-the-magento-framework-phrase-gettracking\/","title":{"rendered":"Call to Undefined Method in the Magento\\Framework\\Phrase::getTracking"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Developing customized shipping modules tailored to store-specific requirements is a common task in Magento 2 development.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019ve encountered the error: <strong>\u201cCall to undefined method Magento\\Framework\\Phrase::getTracking\u201d<\/strong><br>while viewing shipment tracking details in the frontend, don\u2019t worry \u2014 you\u2019re in the right place.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a simple solution for this.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the model file from your shipping method extension and simply add the below function:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public function getTrackingInfo($trackings)\n\n{\n\n$result = $this->_trackFactory->create();\n\n$tracking = $this->_trackStatusFactory->create();\n\n$tracking->setCarrier($this->_code);\n\n$tracking->setCarrierTitle(\"Shipping Title\");\n\n$tracking->setTracking($trackings);\n\n$tracking->setUrl('http:\/\/www.demo.com\/?cn=' . $trackings);\n\n$result->append($tracking);\n\nreturn $tracking;\n\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Where, setUrl creates a clickable URL that redirects the customer to the tracking page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The getTrackingInfo function generates a tracking object for a shipment and provides a tracking URL that can be displayed to customers or used in the admin panel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Try this solution out, and I am positive that it will help you solve the error.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Developing customized shipping modules tailored to store-specific requirements is a common task in Magento 2 development. If you\u2019ve encountered the error: \u201cCall to undefined method&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-19710","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/19710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=19710"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/19710\/revisions"}],"predecessor-version":[{"id":19718,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/19710\/revisions\/19718"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=19710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=19710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=19710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}