Skip to content

Custom theme doesn't apply XML layout updates when applied to a product #7710

@chickenland

Description

@chickenland

I was looking to open this issue, but thought I'd try and find one before I did. I think this issue is linked to #7503, but is manifesting is achieved in a different way

We have a theme that does not inherit, and it's XML updates appear to be ignored.

Preconditions

Magento 2.1.2, PHP 5.6.24
Environment: Windows XAMPP / Windows WSL
Developer Mode

Steps to reproduce

Set the theme for a specific storeview to Purenet/Theme (our default theme for the store) via Content > Design > Configuration > Edit.

Create and install a theme that has no inheritence. Add layout changes. For this example, I created a theme with a catalog_product_view.xml file that removes the main title for the product as Purenet/Client.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="page.main.title" remove="true"/>
</body>
</page>
  1. Deploy static content for the 'Purenet Client' theme:
  2. bin/magento setup:static:deploy --theme="Purenet/Client" en_GB
  3. Apply the 'Purenet Client' theme to a category via Products > Catalog > Actual Product > Schedule Design Update > Set Dates & New theme to be Purenet/Client. Save Product.

Expected result

When checking the the product page, you should not see the main product title.

Actual result

On the Product Page, the main product title is displayed.

Setting a similar XML layout file on a category in the same manner appears to work.

Investigation

So far, it looks like _fetchPackageLayoutUpdates within lib/internal/Magento/Framework/View/Model/Layout/Merge.php doesn't capture the XML that contains the handle updates. I found moving the XML into catalog_product_prices made it added as an update, however, it was still not removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrontendFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions