Skip to content

Magento2 Product not Display in shopping cart

Magento 2 products do not appear on the cart page They appear blank and i use a custom template if i change to Luma The cart page shows the products without a problem, but if you change to the custom template, the products disappear from the cart page, and this is what the picture shows

enter image description here

and the path i get file to customize

public_html/app/design/frontend/Sm/theme/Magento_Checkout/templates/cart/minicart.phtml

<?php

/**

  • Copyright © Magento, Inc. All rights reserved.
  • See COPYING.txt for license details.
    */

// @codingStandardsIgnoreFile

/** @var $block MagentoCheckoutBlockCartSidebar */
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$priceHelper = $objectManager->create(‘MagentoFrameworkPricingHelperData’);
$value = 0;
$priceEmpty = $priceHelper->currency($value, true, false);
?>

getShoppingCartUrl() ?>”
data-bind=”scope: ‘minicart_content'”>

        <!-- ko ifnot: getCartParam('summary_count') -->
            <span class="counter-number">0</span>
        <!-- /ko -->

        <span class="counter-label">
            <!-- ko if: getCartParam('summary_count') -->
            <!-- ko text: getCartParam('summary_count') --><!-- /ko -->
            <!-- ko i18n: 'items' --><!-- /ko -->
            <!-- /ko -->

            <!-- ko ifnot: getCartParam('summary_count') -->
            <!-- ko i18n: '0' --><!-- /ko -->
            <!-- ko i18n: 'item' --><!-- /ko -->
            <!-- /ko -->
        </span>

        <!-- ko if: getCartParam('summary_count') -->
        <span class="price-minicart">
            <!-- ko foreach: getRegion('subtotalContainer') -->
            <!-- ko template: getTemplate() --><!-- /ko -->
            <!-- /ko -->
        </span>
            <!-- /ko -->

            <!-- ko ifnot: getCartParam('summary_count') -->
        <span class="price-minicart">
            <div class="subtotal">
                <div class="amount price-container">
                    <span class="price-wrapper">
                        <span class="price"><?php echo $priceEmpty; ?></span>
                    </span>
                </div>
            </div>
        </span>
            <!-- /ko -->
    </span>


</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
    <div class="block block-minicart"
         data-role="dropdownDialog"
         data-mage-init='{"dropdownDialog":{
            "appendTo":"[data-block=minicart]",
            "triggerTarget":".showcart",
            "timeout": "2000",
            "closeOnMouseLeave": false,
            "closeOnEscape": true,
            "triggerClass":"active",
            "parentClass":"active",
            "buttons":[]}}'>
        <div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
            <!-- ko template: getTemplate() --><!-- /ko -->
        </div>
        <?= $block->getChildHtml('minicart.addons') ?>
    </div>
<?php else: ?>
    <script>
        require(['jquery'], function ($) {
            $('a.action.showcart').click(function () {
                $(document.body).trigger('processStart');
            });
        });
    </script>
<?php endif ?>
<script>
    window.checkout = <?= /* @escapeNotVerified */ $block->getSerializedConfig() ?>;
</script>
<script type="text/x-magento-init">
{
    "[data-block='minicart']": {
        "Magento_Ui/js/core/app": <?= /* @escapeNotVerified */
    $block->getJsLayout() ?>
    },
    "*": {
        "Magento_Ui/js/block-loader": "<?= /* @escapeNotVerified */
    $block->getViewFileUrl('images/loader-1.gif') ?>"
    }
}




</script>