TransWikia.com

Extend Header (logo, search box and cart) in Magento 2

Magento Asked by Bojjaiah on December 28, 2021

I am trying to extend the Header (logo, search box and cart), but those files are the different location. I don’t know how to adjust those. Could you please suggest me on this.

enter image description here

3 Answers

Move search box follow step :

step-1 :- opne Admin 
step-2 :- CONTENT > Block > Home Page Block > show - hide edit button click

add css in style tag

.header.content { text-align: center; } .block-search { float: none; display: inline-block; }

Answered by Himanshu on December 28, 2021

Change below style:

.header.content {
    text-align: center;
}

.logo {
    float: none;
    display: inline-block;
}
.block-search {
    float: none;
    display: inline-block;
}
.minicart-wrapper {
    float: none;
}

Change below code in Magento_Checkoutlayoutdefault.xml

<block class="MagentoCheckoutBlockCartSidebar" name="minicart" as="minicart" after="top.search" template="cart/minicart.phtml">

Answered by Dipesh Rangani on December 28, 2021

The search position is set in the magento-search/view/frontend/layout/default.xml but the issue is that the minicart is set to have the position after "logo" you need to change this in magento-checkout/view/frontend/layout/default.xml

<block class="MagentoCheckoutBlockCartSidebar" name="minicart" as="minicart" after="logo" template="cart/minicart.phtml">

change to

<block class="MagentoCheckoutBlockCartSidebar" name="minicart" as="minicart" after="top.search" template="cart/minicart.phtml">

and after this style the top search so it shouldn't be with a float: right; ( adapt the style as you like )

Also, it is recomanded to make the changes for the checkout module files in app/design/frontend/YOUR_COMPANY/YOUR_THEME/Magento_Checkout/layout/default.xml

Answered by Vlad Patru on December 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP