Anchor Categories
1 min
Out of the box, the Klevu plugin respects the is_anchor category setting.
To change this behaviour and ignore anchor categories you can add a before plugin on ParentAnchorCategoryIdProvider and return an empty array.
<type name="Klevu\IndexingProducts\Service\Provider\Catalog\ParentAnchorCategoryIdProvider">
<plugin name="Vendor_Module::ParentAnchorCategoryIdProvider"
type="Vendor\Module\Plugin\Service\Provider\Catalog\ParentAnchorCategoryIdProviderPlugin"/>
</type>Create the Plugin class.
<?php
namespace Vendor\Module\Plugin\Service\Provider\Catalog;
use Klevu\IndexingApi\Service\Provider\Catalog\ParentAnchorCategoryIdProviderInterface;
class ParentAnchorCategoryIdProviderPlugin
{
/**
* @param ParentAnchorCategoryIdProviderInterface $subject
* @param int[] $categoryIds
*
* @return int[]
*/
public function beforeGet(
ParentAnchorCategoryIdProviderInterface $subject,
array $categoryIds,
): array {
return [[]];
}
}Setting categoryIds param as an empty array will return an empty array skipping any extra database calls.