Magento 2
  • Personalization for Magento 2
  • Installing
  • Disconnecting
  • Uninstalling
  • Getting Started
  • Configuring
  • Hyvä Theme
  • Guides
    • Migrating to Magento2
    • Upgrading to >= 4.0.0
    • Varnish & Full-Page Caches
    • Advanced User Guide
    • Managing Blocks
    • Overriding or Extending Functionalities
      • Overriding Product Data
        • Excluding Products
        • Customising Pricing
        • Customising Categories
        • Resizing Images
      • Overriding Customer Data
    • Console Commands
    • Tagging Providers
  • Features
    • Product data caching
      • Built-in caching
      • Database caching
    • Variations (Configurable Products)
    • Add to Cart
    • Indexer
      • On 7.x
      • On 5.x and 6.x
      • On 4.x
      • On 3.x
    • Customer Group Pricing
    • Supplier Cost & Inventory Level
    • Restore Cart Link
    • Ratings & Reviews
    • Multi Currency (Exchange Rates)
    • Marketing permission and GDPR compatibility
    • Content Staging & Special Prices
  • Integrations
    • Using Yotpo
  • FAQ
  • Developing & Contributing
  • Visit Nosto
  • Issues
  • Releases
  • Addons
    • Multi Source Inventory (MSI)
      • Installing
      • Uninstalling
      • Configuring
    • Category Merchandising (CM 1.0)
      • Installing
      • Uninstalling
      • Configuring
      • Guides
        • Translating Frontend Strings
        • PWA Implementation
        • Using Elasticsearch
        • Segmentation
        • Overriding or Extending Functionalities
          • Customize Query Parameters
          • Customize Page Size Limit
          • Customize Exclude Filters
        • Debugging
Powered by GitBook
On this page

Was this helpful?

  1. Addons
  2. Category Merchandising (CM 1.0)
  3. Guides
  4. Overriding or Extending Functionalities

Customize Exclude Filters

PreviousCustomize Page Size LimitNextDebugging

Last updated 1 year ago

Was this helpful?

If custom product filtering is done on Magento's backend after receiving the GraphQL response from Nosto, this will cause the total counter of displayed products to be inaccurate. To fix this, we recommend adding a custom field to the products and use exclude filters to be sent along with the GraphQL query

Adding exclude filters to GraphQL query

  1. Make sure you followed our guide to create an override module

  2. Use the sample code snippet below to add your custom exclusion logic

<?php

namespace MyNosto\NostoCmp\Plugin;

use Nosto\Cmp\Model\Facet\Facet;

class UpdateExcludedFilters
{
    /**
     * @param $subject
     * @param Facet $facets
     * @return Facet
     */
    public function afterGetFilters($subject, Facet $facets)
    {
        $facets->getExcludeFilters()->setCustomFields(
            "my_custom_field",
            ['my_custom_field_value']
        );

        return new Facet($facets->getIncludeFilters(), $facets->getExcludeFilters());
    }
}
Overriding or Extending Functionalities