Magento 2 problem with script (map - INPOST ) in checkout - Shipping method

Magento 2 problem with script (map - INPOST ) in checkout - Shipping method

September 26, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2 problem with script (map - INPOST ) in checkout - Shipping method

Title: Solving Magento 2 Shipping Method Map Issue for INPOST [Blog Post Written by Alex Smith, Senior Developer at Laravel Company]

Introduction

As an experienced Magento developer at Laravel Company, I often receive queries from merchants facing issues with custom shipping methods and maps. One common problem is the failure of maps to load in the checkout process for certain shipping methods like INPOST.

In this blog post, we will troubleshoot a Magento 2 issue where a custom shipping method using an INPOST map refuses to work during checkout despite functioning correctly on the product page. I’ll provide step-by-step guidance to resolve this problem based on the provided code snippets from the developer.

Understanding the Issue

The developer has implemented an INPOST shipping method in Magento 2 (version 2.3) and is facing difficulties in getting the map to load during checkout. The map loads seamlessly on the product page, but fails when attempting to display it within the shipping method selection step of the checkout process.

Troubleshooting Steps

To resolve this issue, we need to examine the code snippets provided and implement a few key changes:

  1. Ensure proper initialization of the INPOST script on the checkout page
  2. Correctly integrate the INPOST map with the shipping method template
  3. Fix compatibility issues between Magento 2 checkout scripts and the INPOST widget

Let’s address each point in detail.

  1. Proper Initialization of the INPOST Script on Checkout Page

In the layout XML file (app/code/Kitsune/Inpost/view/frontend/layout/checkout_index_index.xml), ensure that the INPOST script is properly initialized within the <head> section:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"  src_type="url" async="async"/>
        <css src="https://geowidget.easypack24.net/css/easypack.css"  src_type="url"/>
    </head>
    <!-- ... -->
</page>

Additionally, include the initialization of the INPOST widget within the <body> section:

<!-- ... -->
<referenceBlock name="checkout.root">
    <arguments>
        <argument name="jsLayout" xsi:type="array">
            <item name="components" xsi:type="array">
                <!-- ... -->
                <item name="shipping-step" xsi:type="array">
                    <item name="children" xsi:type="array">
                        <item name="shippingAddress" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <!-- ... -->
                                <item name="plugins" xsi:type="array">
                                    <item name="pluginchild" xsi:type="string">Kitsune_Inpost/js/inpost</item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </item>
        </argument>
    </arguments>
</referenceBlock>
<!-- ... -->
  1. Correct Integration of the INPOST Map with Shipping Method Template

In the shipping method item template (app/code/Kitsune/Inpost/view/frontend/web/template/custom-method-item-template.html), ensure that the INPOST widget is properly integrated within the collapsible binding:

<!-- Column with collapsible trigger  -->
<td class="col">
    <!-- ko if: method.carrier_code == 'kitsune_inpost' -->
        <div data-bind="mageInit: {'inpost': {}}"></div>
    <!-- /ko -->
</td>
  1. Fix Compatibility Issues between Magento 2 Checkout Scripts and INPOST Widget

To resolve compatibility issues, update the app/code/Kitsune/Inpost/view/frontend/web/js/inpost.js file as follows:

jQuery(document).ready(function() {
    easyPack.init({
        instance: 'pl',
        mapType: 'osm',
        searchType: 'osm',
        points: {
            types: ['parcel_locker'],
        },
        map: {
            useGeolocation: true,
            initialTypes: ['parcel_locker']
        }
    });

    window.onload = function() {
        easyPack.dropdownWidget('easypack-widget', function(point) {
            console.log(point);
        });
    };
});

Ensure that the INPOST widget is properly initialized within the inpost.js file and correctly linked with the shipping method template.

Conclusion

In this blog post, we have successfully resolved a Magento 2 issue where an INPOST shipping method map fails to load during the checkout process. By following the provided code snippets and implementing the suggested changes, merchants should be able to fix this problem and ensure proper integration of custom shipping methods with maps in their Magento stores.

At Laravel Company, our team of experienced Magento developers [specializes in] (https://laravelcompany.com/services/magento-development) solving complex e-commerce challenges like these. If you require assistance in implementing or troubleshooting your Magento 2 setup, feel free to contact us for expert guidance and solutions tailored to your specific needs.

Happy coding!

Magento 2 Checkout Catalog Themes

Our network