Skip to main content
16 votes
Accepted

Removing Welcome message from magento 2 - just xml

The welcome message is in html/header.phtml and the block is referenced from this XML file: /vendor/magento/module-theme/view/frontend/layout/default.xml. The template is referenced by the $_template ...
bassplayer7's user avatar
  • 2,216
10 votes
Accepted

Override header Content and adding block

You can do this by putting DIV over your logo and search box Also create a "container" for your static block (inside this you can call your static block) in logo.phtml. Now assign a class to each ...
Manoj Deswal's user avatar
  • 5,805
10 votes

Override header Content and adding block

you use referenceBlock logo <referenceBlock name="logo"> <block class="Magento\Cms\Block\Block" name="test_links"> <arguments> <argument name="...
Fme Extensions's user avatar
9 votes

Adding a class to block Magento 2

There are 2 ways to do that:- 1- Add wrapping container to your block, like :- <container name="div.header.links" htmlTag="div" htmlClass="header_links" after="-"> <block class="...
Akhilesh Singh's user avatar
9 votes
Accepted

Magento 2: Add block above page-header

Change your default.xml to <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/...
Prince Patel's user avatar
  • 22.9k
9 votes
Accepted

How to use customer token to access my account Query or Mutation in GraphQl

Please try this: Step 1: Get a bearer token: You can get a token by executing the signup mutation in the playground to create a new user. This is the signup mutation I ran: Request: mutation { ...
Narendra Vyas's user avatar
8 votes

Magento 2: get customer().lastname in header.phtml

TLDR; You need to create a plugin in a custom module to override the Magento\Customer\CustomerData\Customer class. In your module's di.xml file: app/code/Vendor/LastName/Plugin/etc/di.xml <?xml ...
circlesix's user avatar
  • 4,333
8 votes
Accepted

Varnish - Error 503 Backend fetch failed (Header too long)

Please check if your runtime parameter changes actually took effect. Please run the following command to validate this: sudo varnishadm param.show | grep "^http_" This will display all ...
Thijs Feryn's user avatar
  • 1,114
7 votes

cannot read property 'section loadurl' of undefined

The data that code references (sectionLoadUrl) is usually set in the following snippet that (should) be on every Magento front-end page <script type="text/x-magento-init"> {"*":{"...
Alana Storm's user avatar
  • 44.4k
7 votes

Magento 2 how to make sticky header for frontend?

You can add this piece of javascript code to your custom.js file and you can call this custom.js file either in default_head_blocks.xml or requirejs-config.js require([ "jquery" ], function($){ $(...
Sejal Shah's user avatar
  • 2,193
6 votes
Accepted

Wrapping search and cart in element Magento 2

I think something like this would work, though I am often wrong :) <referenceContainer name="header-wrapper"> <container name="block-wrapper-to-hold-the-items" as="block-wrapper-to-hold-...
Eamonn's user avatar
  • 508
6 votes

Adding a class to block Magento 2

Looking at the Magento\Framework\View\Element\Html\Link\Current code for version 2.2.6, there is no class argument supported (as documented in the previously accepted answer). However class is an ...
Adam Nemitoff's user avatar
6 votes
Accepted

Magento 2: What is Offloader header?

There is no difference. The default offloader header in Magento 2 is X-Forwarded-Proto, which matches the de facto standard. SSL_OFFLOADED on the other hand, was the default offloader header in ...
Fabian Schmengler's user avatar
6 votes
Accepted

magento2: add static block to header menu

Firstly you need to create static cms block about us. and add your content in content part. Now to add that block in header follow the below steps : Create/Add new category from product/categories ...
Manthan Dave's user avatar
  • 9,906
6 votes

how to show my account link in header after successfully login in magento 2.0

Use the following code to show your account link in header: <?php $objectManagerlogin = \Magento\Framework\App\ObjectManager::getInstance(); $customerSession = $objectManagerlogin->get('...
Abhinav Singh's user avatar
6 votes
Accepted

How to remove class `page-header` of tag `header` in Magento2?

1) To change class of Header Tag , edit your extended/custom default.xml app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml Now add this line of code to change the class , ...
Manoj Deswal's user avatar
  • 5,805
6 votes

How i can change header button (sign in to log in) in magento 2 ? and which file i can change?

The simple way is to add default text with your text into app/design/frontend/Custom/default/i18n/en_US.csv like "Sign In","Login" clear cache after that php bin/magento cache:clean && ...
Hitesh's user avatar
  • 1,579
6 votes

How to get Email address in my phtml file in magento 2

Use helper to get email address in phtml. You can do it by following way. In phtml: $helper = $this->helper('Vendorname\Modulename\Helper\Data'); $email = $helper->getEmails(); //pass storeId ...
Sameer Bhayani's user avatar
5 votes

Magento 2 page-header background color

The easiest way to add simple styling to a magento 2 store is to add your code here: ADMIN > CONTENT > Design > CONFIGURATION Click Edit for the appropriate view (global, website or store) and Theme ...
Joshua34's user avatar
  • 2,317
5 votes
Accepted

Magento 2 theme header - Welcome message

With regards to the XML, that block is called header and is set in \vendor\magento\module-theme\view\frontend\layout\default.xml You can remove it via a theme override at \app\design\frontend\...
RichardB's user avatar
  • 325
5 votes
Accepted

How to change /blog url to some other url in Magento 1.9.2

You can do url rewriting from magento admin panel by following below steps : Logged into magento admin then click on Catalog -> URL Rewrite Management To add new url rewrite rule Click on Add Url ...
Manthan Dave's user avatar
  • 9,906
5 votes
Accepted

How to access the magento 2 graphql api using react js

We also faced the same issue for my Headless project. Try below two possible solutions. Solution 1 : Add the below line at the top of the index.php file. You can find the index.php file in the root ...
Jitendra Patel's user avatar
4 votes

After logging in, the user name is not displaying in header section

For customer name you need to check vendor/magento/module-theme/view/frontend/templates/html/header.phtml code : <span data-bind="text: new String('<?php echo $block->escapeHtml(__('...
Ronak Chauhan's user avatar
4 votes
Accepted

Custom header link not showing in magento 2

Block File, <?php namespace Test\FLinks\Block; class Header extends \Magento\Framework\View\Element\Html\Link{ protected $_template = 'Test_FLink::link.phtml'; public function getHref()...
Rakesh Jesadiya's user avatar
4 votes
Accepted

Moving header links in Magento 1.9

Magento 1 uses the block Mage_Page_Block_Template_Links in the default theme as the block that renders the links. To add links, use the following code in a layout.xml file: <reference name="top....
tjons's user avatar
  • 1,831
4 votes

Magento 2: get customer().lastname in header.phtml

Completely no need to add tons of backend plugins here... Just initiate JS on your span with <span data-mage-init='{"js/customerGreeting":{}}'> and in your theme in web/js/...
adyry's user avatar
  • 271
4 votes

how to remove header links class with ul tag in magento 2?

You can change Links.php at this location :- vendor/magento/framework/View/Element/Html Probably on line no 76 remove the UL or change it to DIV
Manoj Deswal's user avatar
  • 5,805
4 votes

Magento 2 : How to Add Custom Header

If you want to add custom header then you just add this code into Magento_Theme / layout / default.xml <referenceBlock name="header.container" remove="true" /> <referenceContainer name="page....
Dhrumin's user avatar
  • 861
3 votes

Removing Welcome message from magento 2 - just xml

In your theme 'your_theme/Magento_theme/layout/default.xml' add below code <referenceBlock name="header.panel.wrapper" remove="true"/>
Omar's user avatar
  • 131
3 votes

Magento 2: What is Offloader header?

Offloader header and HTTPS server variable are used by Magento 2 to figure out if request is secure (https). if you don't set server variable HTTPS fastcgi_param HTTPS on then magento checks ...
goivvy.com's user avatar
  • 4,213

Only top scored, non community-wiki answers of a minimum length are eligible