# Which twig template to extend for a custom theme?

**URL:** <https://forum.shopware.com/t/which-twig-template-to-extend-for-a-custom-theme/98264>\
**Category:** Themes & Design (EN)\
**Created:** [30. Januar 2023 um 06:25 UTC](https://forum.shopware.com/t/which-twig-template-to-extend-for-a-custom-theme/98264 "2023-01-30T06:25:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![magnus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/magnus/32/13222_2.png) [@magnus](https://forum.shopware.com/u/magnus)\
**Post date:** [30. Januar 2023 um 06:25 UTC](https://forum.shopware.com/t/which-twig-template-to-extend-for-a-custom-theme/98264/1 "2023-01-30T06:25:11Z")

</div>

I run Shopware 6 locally and using the development template. I needed to remove the product number from the product detail page. So, I override the twig template „buy-widget.html.twig“:

```auto
{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %}

{% block page_product_detail_ordernumber_container %}
        
{% endblock %}

```

Works as expected - if I have _not change the layout template_ for the product, but using the Shopware default.

If I change the layout to a custom layout (like a plain copy of the default layout) the product number is back?! 🤔

Checking with the Symfony Profiler, I can see that it’s now another twig template (from a folder „component/…“ responsible for displaying the product number.

Question: Am I correct to assume that I should extend the twig template from this component folder if I’m using a custom layout? I have not find anything in the docs about these „small“ details. And if one need to be sure that a custom theme works in every case, you must make the changes (using sw\_extends) in two files?

/Magnus

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [30. Januar 2023 um 09:09 UTC](https://forum.shopware.com/t/which-twig-template-to-extend-for-a-custom-theme/98264/2 "2023-01-30T09:09:17Z")

</div>

YMMD… you could spend hours on that issue.

It is not about the template, it is about page or component.

Shopware uses for static pages, e.g. search results the page folder. For template pages (designer) the component folder, e.g. the listing or detail page.

Thus you have to change both files.

> **[Search · product-detail-ordernumber · shopware/platform](https://github.com/shopware/platform/search?l=Twig&q=product-detail-ordernumber)**
>
> Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions - Search · product-detail-ordernumber · sh...

---

<div class="post-metadata">

**Author:** ![magnus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/magnus/32/13222_2.png) [@magnus](https://forum.shopware.com/u/magnus)\
**Post date:** [30. Januar 2023 um 14:30 UTC](https://forum.shopware.com/t/which-twig-template-to-extend-for-a-custom-theme/98264/3 "2023-01-30T14:30:47Z")

</div>

😄  
Thanks @Max_Shop . That was what I was afraid of.  
So, best to keep one eye on the Symfony Profiler.
