Skip to content

About

Maxcode_Popup: an editable welcome popup for Magento 2, shown once to each new visitor, content managed in a CMS block per store view (free) / Popup d'accueil éditable pour Magento 2, affichée une fois à chaque nouveau visiteur, contenu dans un bloc CMS par vue (gratuit)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

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.

License: free EULA Magento 2.4 PHP 8.2+ Packagist

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=preview to 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

  1. Content > Blocks: create one block per store view, all with the same identifier (default maxcode_popup), each assigned to its own store view only.
  2. 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
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
  1. Flush the config, block_html and full_page caches.

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

  • 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.

About

Maxcode_Popup: an editable welcome popup for Magento 2, shown once to each new visitor, content managed in a CMS block per store view (free) / Popup d'accueil éditable pour Magento 2, affichée une fois à chaque nouveau visiteur, contenu dans un bloc CMS par vue (gratuit)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages