{"id":2696,"date":"2024-12-31T20:26:01","date_gmt":"2024-12-31T20:26:01","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solved-fatal-error-uncaught-error-call-to-a-member-function-getsectionnames-after-upgrading-magento-2\/"},"modified":"2025-09-01T10:55:57","modified_gmt":"2025-09-01T05:25:57","slug":"uncaught-error-call-to-a-member-function-getsectionnames","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/uncaught-error-call-to-a-member-function-getsectionnames\/","title":{"rendered":"Solved: Fatal Error: Uncaught Error: Call to a Member Function getSectionNames() After Upgrading Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Facing a\u00a0<em><strong>\u201cFatal error: Uncaught Error: Call to a member function getSectionNames()\u201d<\/strong><\/em>\u00a0after\u00a0<a href=\"https:\/\/meetanshi.com\/magento-upgrade-service.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 upgrade<\/a>? Read this blog post to find the complete solution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.adobe.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Adobe<\/a>&nbsp;releases several upgrades throughout the year, fixing various issues and adding new features to the Magento platform. Major upgrades are released every six-twelve months, with minor upgrades and patches in between. These updates introduce new features and functionalities, known bug fixes, and security improvements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, these new feature introductions may conflict with the existing customizations in the store and produce errors. One such error after upgrading Magento version is the \u201cFatal error: Uncaught Error: Call to a member function getSectionNames()\u201d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I recently faced the same issue while upgrading a client\u2019s store from Magento 2.3.3 to the 2.4.5 version. On further investigation, I found the root cause of the problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s understand the cause &amp; the method to solve the issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where is the Problem?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/meetanshi.com\/blog\/magento-2-3-4-release\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2.3.4 release<\/a>&nbsp;has introduced a new argument named&nbsp;<code>sectionNamesProvider<\/code>tag for the frontend blocks. This means Magento assumes a sectionNamesProvider argument for every instance of the block. If you use a custom theme or have overridden the default.xml, you may encounter the \u2018Fatal error: Uncaught Error: Call to a member function getSectionNames()\u2019 error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The solution to \u2018Fatal error: Uncaught Error: Call to a member function getSectionNames()\u2019<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The solution to getting rid of the error in Magento 2 is to find the XML file that is being called by the custom PHTML file and add the argument tag.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, in my case, the error read:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Fatal error: Uncaught Error: Call to a member function getSectionNames() on \/vendor\/magento\/module-customer\/view\/frontend\/templates\/js\/section-config.phtml:20<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, the&nbsp;<code>section-config.phml<\/code>&nbsp;file was causing the error here.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, we need to find the XML file where this PHTML file is called and add the argument tag as per the&nbsp;<code>default.xml<\/code>&nbsp;file<\/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=\"\">&lt;block name=\"customer.section.config\" class=\"Magento\\Customer\\Block\\SectionConfig\"\n               template=\"Magento_Customer::js\/section-config.phtml\">\n            &lt;arguments>\n                &lt;argument name=\"sectionNamesProvider\" xsi:type=\"object\">Magento\\Customer\\Block\\SectionNamesProvider&lt;\/argument>\n            &lt;\/arguments>\n        &lt;\/block><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and the problem will be solved!<br><strong>Solution to a similar error:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/meetanshi.com\/blog\/error-call-to-a-member-function-isclearshoppingcartenabled-on-null\/\" target=\"_blank\" rel=\"noreferrer noopener\">Error Call to a member function isClearShoppingCartEnabled()<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I hope the above method will help solve the issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d be happy to help you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do not forget to share this solution with your developer friends!  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Facing a\u00a0\u201cFatal error: Uncaught Error: Call to a member function getSectionNames()\u201d\u00a0after\u00a0Magento 2 upgrade? Read this blog post to find the complete solution. Adobe&nbsp;releases several upgrades&#8230;<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2696","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2696","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\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2696"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions"}],"predecessor-version":[{"id":21275,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2696\/revisions\/21275"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}