Hi
main.CRITICAL: The element 'checkout.cart.item.renderers' already has a child with alias 'virtual' {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element 'checkout.cart.item.renderers' already has a child with alias 'virtual' at /home/xxxxxxxxxx/public_html/vendor/magento/framework/Data/Structure.php:611)"} []
Please suggest a fix for this...
Hi @Rakesh Jesadiya
Thanks for your quick reply...
checkout_cart_item_renderers.xml is in the path /theme/Magento_Catalog/layout/
<?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="checkout.cart.item.renderers"> <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="virtual" template="cart/item/default.phtml"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.virtual.actions" as="actions"> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.virtual.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/> <block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.virtual.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/> </block> </block> </referenceBlock> </body> </page>
checkout_cart_index.xml from /theme/Magento_Checkout/layout/
<?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="checkout.cart.container"> <container name="cart.discount" label="Cart Discount Container" htmlTag="div" htmlClass="cart-discount" after="-" /> </referenceContainer> <move element="checkout.cart.crosssell" destination="checkout.cart.container" after="-" /> <move element="checkout.cart.coupon" destination="cart.discount" /> <move element="checkout.cart.shortcut.buttons" destination="checkout.cart.methods" after="checkout.cart.methods.onepage.bottom"/> <referenceBlock name="breadcrumbs"> <action method="addCrumb"> <argument name="crumbName" xsi:type="string">Home</argument> <argument name="crumbInfo" xsi:type="array"> <item name="title" xsi:type="string">Home</item> <item name="label" xsi:type="string">Home</item> <item name="link" xsi:type="string">/</item> </argument> </action> <action method="addCrumb"> <argument name="crumbName" xsi:type="string">Shopping Cart</argument> <argument name="crumbInfo" xsi:type="array"> <item name="title" xsi:type="string">Shopping Cart</item> <item name="label" xsi:type="string">Shopping Cart</item> </argument> </action> </referenceBlock> </body> </page>
Hello @RizeTech
Please remove that your theme xml file and check it.
If it is working then issue into your xml.
Did you mean theme file means the under the path theme/Magento_Theme/layout/default.xml
Hi
Removed checkout_cart_item_renderers.xml file from Magento_Catalog/layout folder.
Now the exception was not generating ....But still the check out page and cart page is blank...
Please run command,
php bin/magento setup:static-content:deploy -f
Also remove xml file from Magento_Checkout theme also
Hi
Removed the checkout_cart_item_renderes.xml file and checkout_cart_index.xml file and run the commands But nothing works..
We are having some other xml files here ..Is there any issue with them or only with the above two file based on the exception:
main.CRITICAL: The element 'checkout.cart.item.renderers' already has a child with alias 'virtual' {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): The element 'checkout.cart.item.renderers' already has a child with alias 'virtual' at /home/xxxxxxxxxx/public_html/vendor/magento/framework/Data/Structure.php:611)"} []
Hi @RizeTech
Do you have installed any third-party extensions related to cart/checkout ? also have you installed any third-party/custom theme in your magento 2 ?
No...
We are using Ctech_Configurator package extension for the product configuration using their API.
Hi @RizeTech
ok - to confirm , do one thing disabled all the third-party extension which you are using and enabled only magento 's native extensions !
Also change your magento 2 theme to luma theme - which might be already set
Now as its showing localizedException - so run below commands !
rm -rf generated rm -rf var/cach php bin/magento setup:upgrade php bin/Magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento cache:clean php bin/magento cache:flush
Then check !