Filter hooks

Developers can customise the behaviour of the minicart through filter hooks. There are some useful filter hooks supported by this plugin, and by WooCommerce itself.

Here’s some example code that uses these filter hooks:

  • woocommerce_cart_minicart_icon

    • string $icon the HTML for the icon
    • return: string

    Change the icon for the minicart. You can return an image tag or SVG here if you prefer.

  • woocommerce_lurking_minicart_classes

    • array $classes
    • return: array

    Add some custom classes to the wrapper for the minicart.

  • woocommerce_lurking_minicart_css_fixes

    • array $classes
    • return: array

    Add or remove direct CSS fixes applied via an inline style tag in the page header.

  • woocommerce_lurking_minicart_is_required

    • bool $required
    • string $context can be ‘edge’, ‘widget’, ‘menu’, ‘manual’
    • string $position can be ‘left’, ‘right’, ‘widget’, ‘menu’
    • return: bool

    Change whether the minicart is displayed on any given page. You can use this to hide the cart on specific pages, e.g. by testing for page IDs: is_page([12,13,14])

  • woocommerce_lurking_minicart_position

    • string $position can be ‘left’, ‘right’, ‘widget’, ‘menu’
    • return: string

    Change where the minicart will sit on any given page.