For some specific categories we would like to change the default value for Products per Page on Grid Default Value
. By default it’s set to 24.
In our custom theme we create a custom page_layout with the following code. But sadly it does not work, it still use the default value 24. What are we missing here?
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<update handle="2columns-left"/>
<referenceContainer name="content">
<referenceBlock name="product_list_toolbar">
<action method="setDefaultGridPerPage">
<argument name="limit" xsi:type="string">23</argument>
</action>
</referenceBlock>
</referenceContainer>
</layout>
Edit:
When we create a Custom Layout Update
for the specific category, it does work well with the following code. But we prefer to add it to the category layout itself, instead of creating a custom. layout update for each category. How can we achieve that?
Custom Layout Update code:
<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="content">
<referenceBlock name="product_list_toolbar">
<action method="setDefaultGridPerPage">
<argument name="limit" xsi:type="string">23</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>