kowal.info

Auto Hide Message

Composer kowal/module-autohidemessage · Version 1.0.0

Product page

A product page on kowal.co has not been confirmed.

Description

Automatically dismisses storefront notifications displayed by the standard Magento messages component.

For whom

For storefront managers who want a confirmation to disappear automatically after a shopper performs an action.

Features

  • Observe notifications delivered to the standard Magento messages component.
  • Start a three-second delay when the component receives a new list.
  • Clear the messages together when the delay expires.

Installation

From the Magento root, with Composer access to the Kowal package, run

composer require kowal/module-autohidemessage
bin/magento module:enable Kowal_AutoHideMessage
bin/magento setup:upgrade
bin/magento cache:clean

Configuration

Once enabled, the module listens for a new list of messages from Magento_Theme/js/view/messages. After three seconds it clears the entire messages section. The delay is set in the RequireJS mixin.

Requirements / notes

The timer runs in the storefront’s RequireJS mixin. Check the theme’s message renderer before testing on a customized storefront.

FAQ

Can I change the delay in Magento Admin?

The installed mixin defines the delay. Changing it requires a frontend customization and deployment of the updated JavaScript.

Verify the installation

Add a product to the cart in a theme that uses the standard Magento messages component. Watch the confirmation without reloading the page. It should disappear after about three seconds. If it stays visible, check whether the theme uses its own notification component.