0
votes

Shopware 6 | Cloning CmsElement and get null as data, and in the Shopware 6 Forum: https://forum.shopware.com/discussion/67124/custom-product-box-no-data-in-the-storefront

I found this answer, but as I am still learning Shopware 6, I don't know if this is relevant for me. I have cloned the CMS Product Box Element, as I need to change the layout and add more flags/badges, but when I do a dump I get element.data = null. Would I also need to create a resolver too, or should I have just tried to extend the element with {% sw_extends '@Storefront/storefront/element/cms-element-product-box.html.twig' %}? But if I just extend I can't make the changes I want to the component.

Any suggestions or hints on how to solve the problem would be appreciated. Thanks.

1

1 Answers

1
votes

I figured out it was much simpler than creating a new element. In the end, I found which components were being included and found that to change the layout and add a new badge I just needed to {% sw_extends '@Storefront/storefront/component/product/card/badges.html.twig' %} and for the parts of the product-box, just find the corresponding component and make the changes I needed to make in my plugin.