maxcode / module-popup
EN: Editable welcome popup for Magento 2 - shown once to each new visitor, content managed in a CMS block per store view, no third-party dependency. FR : Popup d'accueil editable pour Magento 2 - affichee une seule fois a chaque nouveau visiteur, contenu gere dans un bloc CMS par vue de magasin, san
Package info
github.com/eBusiness360/module-popup
Language:HTML
Type:magento2-module
pkg:composer/maxcode/module-popup
Requires
- php: >=8.2
- magento/framework: *
- magento/module-cms: *
- magento/module-config: *
- magento/module-store: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
English · Français
Maxcode Popup for Magento 2
An editable welcome popup, shown once to each new visitor. Its content is a CMS block, per store view. Free, no third-party dependency.
What it does
- A welcome popup shown once, on the page where the visitor arrives, after a delay you set.
- Content you edit in the admin. It is a CMS block (Content > Blocks), one per store view with the same identifier: one text per shop, edited with the usual editor.
- Campaigns. The visitor's choice is kept per campaign. Change the campaign name and the popup shows again to everyone: do it for each new announcement.
- Cookie-banner friendly. A modal popup makes the rest of the page inactive, banner included. Give the CSS selector of your banner and the popup waits until it is gone.
- Safe by default. Never in the cart, the checkout, the order confirmation or the parcel tracking page, and never for search-engine crawlers. A functional cookie with no personal data.
- Easy to proofread. Add
?mxc-popup=previewto any page address to show the popup on every load, without cookie. - Light. The content sits in a
<template>: it is not rendered in the page and its images load only when the popup opens. No JavaScript library. - Accessible. Native
<dialog>(focus kept inside, Esc to close), labelled close button, reduced motion respected. - Translated into English and French.
Installation
composer require maxcode/module-popup bin/magento module:enable Maxcode_Popup bin/magento setup:upgrade bin/magento cache:flush
The module has no database schema. Requirements: Magento Open Source or Adobe Commerce 2.4.x, PHP 8.2 or later.
Usage
- Content > Blocks: create one block per store view, all with the same identifier (default
maxcode_popup), each assigned to its own store view only. - Stores > Configuration > Maxcode > Popup, at the scope you want (default, website or store view):
| Setting | Role |
|---|---|
| Enable the popup | turns the popup on or off |
| Show from | optional start, YYYY-MM-DD or YYYY-MM-DD HH:MM, store time zone |
| Show until | optional end, same format, for example 2026-12-18 12:00; a date without time includes the whole day |
| CMS block identifier | the block shown, maxcode_popup by default |
| Campaign name | change it to show the popup again to everyone |
| Delay before opening (seconds) | 3 by default, 0 = as soon as the page is ready |
| Do not show again for (days) | 365 by default, 0 = until the browser is closed |
| Wait for this element to disappear (CSS selector) | optional, for a cookie banner |
| Maximum width (pixels) | 520 by default |
- Flush the
config,block_htmlandfull_pagecaches.
Writing the content
The block is plain HTML. Classes provided: mxc-popup__title, mxc-popup__text, mxc-popup__btn. Any element
with the data-mxc-popup-close attribute closes the popup (a "Discover" button, a link...).
<h2 class="mxc-popup__title">A new design</h2> <p class="mxc-popup__text">The same products, the same service.</p> <button type="button" class="mxc-popup__btn" data-mxc-popup-close>Discover the site</button>
Styling
Your theme can redefine these properties on :root: --mxc-popup-bg, --mxc-popup-color, --mxc-popup-radius,
--mxc-popup-accent, --mxc-popup-accent-contrast, --mxc-popup-focus. The dark backdrop is set on
.mxc-popup::backdrop.
Good to know
-
Start and end dates work with full-page cache and Varnish. The browser also checks the dates, so a page cached before the start or the end still opens or hides the popup at the right time. After the end, the popup is no longer in the page once the cache is refreshed.
?mxc-popup=previewignores the dates, to proofread a popup in advance. -
Google penalizes windows that hide the content as soon as a visitor arrives from a search, especially on mobile. Keep the message short, wait a few seconds and make the close button obvious.
-
The visitor's choice is kept in the
mxc_popup_<campaign>cookie (functional, no personal data: no consent required, but it may be listed in your cookie policy).
Changelog
See CHANGELOG.md.
License and support
Free for any number of Magento installations that you own or operate. You receive the full source code and may adapt it to your needs; redistribution is not allowed. See LICENSE (free-module EULA).
Provided as is, without support or update commitment. For questions and paid services: ebusiness360.fr.