1

I have moved the mini cart before top.search using below code in my theme under

app/design/frontend/Mytheme/luma_child/Magento_Checkout/layout/default.xml

  <?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">
   <body>
     <referenceContainer name="header-wrapper">
        <block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="top.search" template="Magento_Checkout::cart/minicart.phtml">
        -------rest of the code ---------
      </referenceContainer>
   </body>
  </page>

This code moves minicart before top.search successfully but it is breaking the minicart item rendering block

enter image description here

giving error in console like below

Uncaught TypeError: Unable to process binding "if: function(){return 
getCartParam('summary_count') }"
Message: Unable to process binding "foreach: function(){return { 
data:getCartItems(),as:'item'} }"
Message: Unable to process binding "foreach: function(){return $parent.getRegion($parent.getItemRenderer(item.product_type)) }"
Message: Cannot read property 'simple' of undefined
at UiClass.getItemRenderer (minicart.js:138)
at foreach (eval at createBindingsStringEvaluator (knockout.js:2624), <anonymous>:3:93)
at knockout.js:3889
at Object.init (knockout.js:5023)
at init (knockout.js:3914)
at knockout.js:2989
at Object.ignore (knockout.js:1249)
at knockout.js:2988
at Object.arrayForEach (knockout.js:151)
at applyBindingsToNodeInternal (knockout.js:2974)

Can anyone suggest how to move it properly? Or do I need to make any adjustment in minicart.js?

2
  • @PrathapGunasekaran Yes i will check in some time and let you know its working or not Mar 29, 2019 at 12:41
  • Is this working @chiragdodia Mar 30, 2019 at 4:08

1 Answer 1

2

Try this,

Remove your above code and add this code in default.xml

 <?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">
 <body>
    <move element="minicart" destination="header-wrapper" after="top.search"/>
 </body>
</page>

Hope this will work out for you :)

0

Your Answer

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

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