0

I want to make the Free Shipping content at the top center of the site but it is in right corner.

How to change the css for doing it?

Created a block on the admin panel and applied this code on Magento_Theme/layout/default.xml

 <referenceContainer name="header.panel"> 
            <block class="Magento\Cms\Block\Block" name="block_identifier"> 
                <arguments> 
                    <argument name="block_id" xsi:type="string">block_identifier</argument> 
                </arguments> 
            </block> 
        </referenceContainer>
5
  • are you trying to make a new bar in the header with a custom template? Jun 3, 2021 at 5:32
  • yes and its a child theme of the magento luma
    – kks
    Jun 3, 2021 at 5:35
  • I have been trying to do it from a long time but no changes
    – kks
    Jun 3, 2021 at 5:36
  • Actually I've made a bar in header with my own custom block, template and CSS, so I could apply the styling however I wished. I'm not sure if this is your requirement. I chose header.container ad referenceContainer. Jun 3, 2021 at 5:38
  • yes thats what I want at the top new grey line with the text free shipping in the place of signin and create account liks and language option
    – kks
    Jun 3, 2021 at 5:40

2 Answers 2

0

If you want to add a new bar in the header, following code should work. In your frontend's default.xml file put below code :

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <head>
         <css src="Vendor_Module::css/vendor.shipping.bar.css"/>
    </head>
     <body>      
       <referenceContainer name="footer-container">
           <block class="Vendor\Module\Block\BottomBar" name="bottomshipping_bar" template="Vendor_Module::bar/bottomshippingbar.phtml">
               
           </block>
       </referenceContainer>
       <referenceContainer name="header.container">
           <block class="Vendor_Module\Block\TopBar" name="topshipping_bar" template="Vendor_Module::bar/topshippingbar.phtml">        
           </block>
       </referenceContainer>
       
   </body>
</page>

This code can add bars to both header and footers. In corresponding template and CSS files you can just do whatever you want with the bar i-e styling or php function. Hope, it helps.

4
  • its not working
    – kks
    Jun 3, 2021 at 5:52
  • 176 679 344 could you please access the system and resolve the issue if you have time.
    – kks
    Jun 3, 2021 at 5:53
  • How can I access your system? Moreover, this is pretty simple . I hope you are clear about blocks and templates in magento and are adding your html in template file. If you still getting error, feel free to ask! Jun 3, 2021 at 6:18
  • do you know how to change the default content of the display notice option?
    – kks
    Jun 3, 2021 at 7:29
0
<referenceContainer name="after.body.start">
                 <block class="Magento\RequireJs\Block\Html\Head\Config" name="requirejs-config"/>
               <block class**strong text**="Magento\Framework\View\Element\Js\Cookie" name="js_cookies" template="Magento_Theme::js/cookie.phtml"/>
                  <block class="Magento\Theme\Block\Html\Notices" name="global_notices" template="Magento_Theme::html/notices.phtml"/>
    
    </referenceContainer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.