Search by

mily / magento2-ooh-widget

katarinabanovic

Mily OOH Checkout Widget for Magento 2: parcel locker and parcel shop selection in the checkout.

Package info

github.com/mily-tech/magento2-ooh-widget

Type:magento2-module

pkg:composer/mily/magento2-ooh-widget

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0-rc10 2026-12-04 10:19 UTC

README

Shows the Mily pickup point widget (parcel lockers and parcel shops) in the Magento checkout, for the shipping methods you choose, and saves the point the shopper picks on the order.

The module does what Mily's developer integration guide asks of a shop: your server opens a widget session with your API key, the checkout shows the widget, and the chosen point is kept. It leaves the shopper's address alone; what you do with the point (shipping label, carrier integration, ERP) is yours.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.7 or later, or Mage-OS, with the standard (Luma) checkout or Amasty One Step Checkout. A Hyvä theme with the Luma checkout works; Hyvä Checkout, PWA Studio and headless storefronts are not supported.
  • From Mily: an API key (sk_test_… for staging, sk_live_… for production), and your checkout domains, staging included, registered with Mily.
  • Your server can reach https://api.app.milytech.com over HTTPS.

Install

composer require mily/magento2-ooh-widget
bin/magento module:enable Mily_OohWidget
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
bin/magento cache:flush

Configure

Stores → Configuration → Sales → Mily pickup point widget, per website:

Setting
Enabled Yes
API key Your key from Mily, stored encrypted. Save, then Test connection.
Shipping methods Your shipping methods that should show the widget, e.g. your parcel locker rate. None of your own: use the module's, below
Hide cash on delivery Yes takes the payment methods you pick (Cash On Delivery by default) off the checkout for a pickup point that takes neither cash nor card, or, by the rule you pick, any that takes no cash
Widget language From the store locale (Serbian → sr, else en), or fixed
Widget on a desktop In the checkout, under the shipping methods, or in a window the shopper opens with a button. A window gives the widget room for its list beside the map; in the checkout a column narrower than 720px gets the list as a sheet over the map. A phone always shows it in the checkout
Widget height In the checkout: desktop (default 600px) for a widget at least 720px wide, phone (default 85vh) for a narrower one
Advanced → API URL, Widget URL Leave as they are unless Mily asks you to change them; the checkout's CSP allows the Widget URL in frame-src

A shop whose only shipping method is delivery to an address can add pickup as a second one: Stores → Configuration → Sales → Delivery Methods → Mily pickup point. Set Enabled, the title and method name the shopper sees (English until you change them), the price, and optionally the order amount it is free from, the countries and the sort order. The widget always shows for it. It is offered on the storefront's single-address checkout only, not for admin orders or multi-address checkout, where no point can be picked.

The key can also be set from the command line, e.g. in a deploy script. Read it from your secret store, so it stays out of the script and the shell history:

bin/magento config:set --scope=websites --scope-code=base mily_ooh/general/api_key "$MILY_API_KEY"

What the shopper sees

When the shopper selects one of the configured shipping methods, the widget opens under the shipping methods, or, with Widget on a desktop set to a window, a "Select pickup point" button does; the window closes on a pick. "Next" stays blocked until they pick a point, and an order with such a method and no point is refused. If the widget cannot load, it hides and keeps the point already picked or, without one, asks the shopper to choose another delivery method. The order has the last point picked, also when the shopper changes it after the checkout saved the shipping information.

A picked point stays until the shopper picks another. It is saved on the quote as soon as it is picked, so after a reload, also before "Next", the checkout shows it with "Change pickup point"; opening the widget again leaves it in place. Another shipping method sets the point aside, so its order has none, and coming back to the pickup method on the same page brings it back. The widget opens with no point marked.

Where the point is

On the quote and the order, in mily_point_id, mily_point_carrier, mily_point_name, mily_point_address, mily_point_town, mily_point_town_id, mily_point_kind (parcel_locker or parcel_shop, empty for any other), mily_point_pay_by_cash and mily_point_pay_by_card. A point is identified by carrier and ID together. An order has it only when its shipping method shows the widget. It shows in:

  • the admin order view and the customer's and guest's order view;
  • the order confirmation and shipment emails, under the items, with no template change;
  • REST, GET /V1/orders/:id and GET /V1/orders, as extension_attributes.mily_ooh_point.

Cookie consent

Mily's analytics follow the shopper's choice in your cookie banner. By default the module sends no consent, and the widget then sends only strictly necessary events. To pass it, add a RequireJS mixin in your theme or module:

// requirejs-config.js
var config = {
    config: {
        mixins: {
            'Mily_OohWidget/js/consent': {'Vendor_Module/js/mily-consent-mixin': true}
        }
    }
};
// Vendor_Module/js/mily-consent-mixin.js
define(['mage/utils/wrapper'], function (wrapper) {
    'use strict';

    return function (consent) {
        return wrapper.wrap(consent, function () {
            // Your code: the shopper's choice from your cookie banner, here Cookiebot.
            // Return nothing when there is no choice to read.
            if (!window.Cookiebot || !window.Cookiebot.consent) {
                return undefined;
            }

            return window.Cookiebot.consent.statistics ? 'basic' : 'denied';
        });
    };
});

When the shopper changes their choice, dispatch window.dispatchEvent(new Event('mily-ooh:consent-changed')) and the widget reloads with it.

Troubleshooting

Problem Check
The widget area stays blank Your domain is not registered with Mily, or a custom CSP blocks the Widget URL (https://ooh-widget.milytech.com) in frame-src
"Pickup points cannot be loaded right now" Test connection in the settings; var/log/system.log has the error code (never the key)
The widget does not open The selected method is not in Shipping methods, or Enabled is No for the website
Changes do not show bin/magento cache:flush; in production mode also setup:static-content:deploy

Questions: support@milytech.com.

Development

A local Mage-OS shop in Docker. This repository is mounted into its app/code/Mily/OohWidget, so edits apply at once; shops install the package into vendor/ with Composer instead. Emails the shop sends land in Mailpit at http://localhost:8025.

cp dev/.env.example dev/.env   # add Mily's test API URL, widget host and test key
docker compose -f dev/docker-compose.yml up -d --build
docker compose -f dev/docker-compose.yml exec php sh /module/dev/install.sh

The shop runs at http://localhost:8080, the admin at http://localhost:8080/admin, with the credentials from dev/.env. Run bin/magento as www-data (exec -u www-data), or the files it writes lock the shop out of its own cache. dev/install.sh and dev/install-hyva.sh describe how to run other Mage-OS releases and Hyvä as separate stacks.

Checks:

docker compose -f dev/docker-compose.yml exec php vendor/bin/phpunit -c /module/phpunit.xml.dist
docker compose -f dev/docker-compose.yml exec php vendor/bin/phpcs --standard=Magento2 --extensions=php,phtml,xml,less --ignore=/module/dev,/module/vendor,/module/node_modules /module
docker compose -f dev/docker-compose.yml exec -u www-data php php /module/dev/check-session.php

The checkout scripts' tests run on the host, with Node 22:

npm ci
npm test

CI (.github/workflows/ci.yml) runs PHPUnit, the coding standard (errors only) and the script tests on every pull request.

License

OSL-3.0