1

I'm working on developing my own theme by extending the Magento Blank theme.

I'm trying to add the minicart to my header.phtml file.

I'm loading the minicart in my header like so:

<?php echo $this->getLayout()
      ->createBlock('Magento\Checkout\Block\Cart\Sidebar')
      ->setTemplate('Magento_Checkout::cart/minicart.phtml')
      ->toHtml(); ?>

The minicart shows on the frontend, but does not load the content, see link: https://prnt.sc/mrrgli

Is there anything I'm missing?

0

first we have to override web/template files to our magento theme file, in my case content.html

Magento_Checkout/web/template/minicart/content.html

After changes in content.html file, we have to deploy static file using command

php bin/magento setup:static-content:deploy

OR

You have to delete content.html(i have to change content in this file) file from pub/static/frontend/Magento/buytea/en_US/Magento_Checkout/template/minicart and reload page again.

  • I have the 'Magento_Checkout/web/template/minicart/content.html' saved under my theme, I ran a 'static-content:deploy' but the source shows the content template isn't being loaded still – Howliee Mar 1 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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