{"id":3233,"date":"2022-07-08T05:39:06","date_gmt":"2022-07-08T05:39:06","guid":{"rendered":"https:\/\/www.cynoinfotech.com\/?p=3233"},"modified":"2026-04-16T13:32:11","modified_gmt":"2026-04-16T13:32:11","slug":"how-to-load-product-by-sku-in-magento-2","status":"publish","type":"post","link":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/","title":{"rendered":"How to load product by SKU in Magento 2"},"content":{"rendered":"<p>Getting product data is a need of many developers so this blog is the best for it. In this blog, we will explain how to get product data using SKU in Magento 2.<\/p>\n<p>If you want to get product data by ID. Please <a href=\"https:\/\/www.cynoinfotech.com\/how-to-load-product-by-id-in-magento-2\/\">Click Here<\/a><\/p>\n<p>Factory method and object manager are the two different ways to lode Product data.<\/p>\n<p>If you want to overuse this function, you can create it in Helper. Otherwise use the blog. We are currently using Helper.<\/p>\n<ul>\n<li><strong>Load Product By SKU Using Factory Method :<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">&lt;?php\nnamespace VendorName\\ModuleName\\Helper;\nuse Magento\\Framework\\App\\Helper\\Context;\nuse Magento\\Catalog\\Model\\ProductRepository;\nclass Data extends AbstractHelper\n{\n    protected $productRepository;\n    public function __construct(Context $context, ProductRepository $productRepository)\n    {\n        $this-&gt;productRepository = $productRepository;\n        parent::__construct($context);\n    }\n    public function getProductDataUsingSku ($sku)\n    {\n        if ($this-&gt;productRepository-&gt;get($sku)) \n        {\n            $product = $this-&gt;productRepository-&gt;get($sku);\n            $id = $product-&gt;getEntityId();\n            $name = $product-&gt;getName();\n            \/\/$product-&gt;getData(); -&gt; use this and get all product data\n        }\n    }\n}\n<\/pre>\n<ul>\n<li><strong>Call phtml file :<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\">$sku = \u201cACY-123\u201d;\n$product = $block-&gt;getProductDataUsingSku($sku);\necho $product-&gt;getName();\n\/\/$product-&gt;getData(); -&gt; use this and get all product data\n<\/pre>\n<ul>\n<li><strong>Load Product By SKU Using ObjectManager :<\/strong><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">$sku = \u201cA-123\u201d;\n$objectManager = \\Magento\\Framework\\App\\ObjectManager::getInstance();\n$product = $objectManager-&gt;get('Magento\\Catalog\\Api\\ProductRepositoryInterface')-&gt;get($sku);\n<\/pre>\n<p>We&#8217;re sure you understand this blog and if there&#8217;s a problem show it in the comments section below.<\/p>\n<p>Thank You!!..<\/p>\n<p>We are bringing in the next block\u00a0\u00a0 <a href=\"https:\/\/www.cynoinfotech.com\/how-to-get-product-collection-using-a-factory-method-in-magento-2\/\">HOW TO GET PRODUCT COLLECTION USING A FACTORY METHOD IN MAGENTO 2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting product data is a need of many developers so this blog is the best for it. In this blog, we will explain how to get product data using SKU in Magento 2. If you want to get product data by ID. Please Click Here Factory method and object manager are the two different ways [&hellip;]<\/p>\n","protected":false},"author":670,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3233","post","type-post","status-publish","format-standard","hentry","category-magento-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to load product by SKU in Magento 2 - cynoinfotech<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/\"},\"author\":{\"name\":\"Arjun Makadiya\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#\\\/schema\\\/person\\\/f1be8186602d3ebf417cf58baf125f24\"},\"headline\":\"How to load product by SKU in Magento 2\",\"datePublished\":\"2022-07-08T05:39:06+00:00\",\"dateModified\":\"2026-04-16T13:32:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/\"},\"wordCount\":144,\"publisher\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#organization\"},\"articleSection\":[\"Magento blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/\",\"url\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/\",\"name\":\"How to load product by SKU in Magento 2 - cynoinfotech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-07-08T05:39:06+00:00\",\"dateModified\":\"2026-04-16T13:32:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/how-to-load-product-by-sku-in-magento-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to load product by SKU in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/\",\"name\":\"cynoinfotech\",\"description\":\"web design &amp; development\",\"publisher\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#organization\",\"name\":\"Cynoinfotech\",\"url\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.cynoinfotech.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/final-logo-ci.png\",\"contentUrl\":\"https:\\\/\\\/www.cynoinfotech.com\\\/wp-content\\\/uploads\\\/2017\\\/11\\\/final-logo-ci.png\",\"width\":240,\"height\":70,\"caption\":\"Cynoinfotech\"},\"image\":{\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/cynoinfotech\\\/\",\"https:\\\/\\\/x.com\\\/cynoinfotech\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/#\\\/schema\\\/person\\\/f1be8186602d3ebf417cf58baf125f24\",\"name\":\"Arjun Makadiya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g\",\"caption\":\"Arjun Makadiya\"},\"description\":\"Arjun Makadiya is a Junior Magento Developer at Cynoifotech. He is passionate about technology. Apart from work he likes to play cricket.\",\"url\":\"https:\\\/\\\/cynoinfotech.com\\\/blog\\\/author\\\/arjun-makadiya\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to load product by SKU in Magento 2 - cynoinfotech","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/"},"author":{"name":"Arjun Makadiya","@id":"https:\/\/cynoinfotech.com\/blog\/#\/schema\/person\/f1be8186602d3ebf417cf58baf125f24"},"headline":"How to load product by SKU in Magento 2","datePublished":"2022-07-08T05:39:06+00:00","dateModified":"2026-04-16T13:32:11+00:00","mainEntityOfPage":{"@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/"},"wordCount":144,"publisher":{"@id":"https:\/\/cynoinfotech.com\/blog\/#organization"},"articleSection":["Magento blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/","url":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/","name":"How to load product by SKU in Magento 2 - cynoinfotech","isPartOf":{"@id":"https:\/\/cynoinfotech.com\/blog\/#website"},"datePublished":"2022-07-08T05:39:06+00:00","dateModified":"2026-04-16T13:32:11+00:00","breadcrumb":{"@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cynoinfotech.com\/blog\/how-to-load-product-by-sku-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cynoinfotech.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to load product by SKU in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/cynoinfotech.com\/blog\/#website","url":"https:\/\/cynoinfotech.com\/blog\/","name":"cynoinfotech","description":"web design &amp; development","publisher":{"@id":"https:\/\/cynoinfotech.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cynoinfotech.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cynoinfotech.com\/blog\/#organization","name":"Cynoinfotech","url":"https:\/\/cynoinfotech.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cynoinfotech.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.cynoinfotech.com\/wp-content\/uploads\/2017\/11\/final-logo-ci.png","contentUrl":"https:\/\/www.cynoinfotech.com\/wp-content\/uploads\/2017\/11\/final-logo-ci.png","width":240,"height":70,"caption":"Cynoinfotech"},"image":{"@id":"https:\/\/cynoinfotech.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cynoinfotech\/","https:\/\/x.com\/cynoinfotech"]},{"@type":"Person","@id":"https:\/\/cynoinfotech.com\/blog\/#\/schema\/person\/f1be8186602d3ebf417cf58baf125f24","name":"Arjun Makadiya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d1792fe07de4cbcd8b55a0a55e79e3a67f4df3ab63af6b0738833c83cac0eab3?s=96&d=mm&r=g","caption":"Arjun Makadiya"},"description":"Arjun Makadiya is a Junior Magento Developer at Cynoifotech. He is passionate about technology. Apart from work he likes to play cricket.","url":"https:\/\/cynoinfotech.com\/blog\/author\/arjun-makadiya\/"}]}},"_links":{"self":[{"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/3233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/users\/670"}],"replies":[{"embeddable":true,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/comments?post=3233"}],"version-history":[{"count":6,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/3233\/revisions"}],"predecessor-version":[{"id":3254,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/3233\/revisions\/3254"}],"wp:attachment":[{"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/media?parent=3233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/categories?post=3233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cynoinfotech.com\/blog\/wp-json\/wp\/v2\/tags?post=3233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}