Voltar

VibeFox PostNord for Adobe Commerce — Ajuda

Requirements

Magento: Magento Open Source or Adobe Commerce 2.4.6 to 2.4.9, on your own server or hosting, on premises or on Adobe Commerce on cloud infrastructure. The module does not work with Adobe Commerce as a Cloud Service (the SaaS edition), which does not accept PHP modules.

PHP: 8.1 to 8.4, with the cURL extension.

PostNord API key (for the service point picker): create a free account on developer.postnord.com, add an application and copy its API key. Without a key the shipping methods still work, but customers cannot pick a service point.

PostNord agreement: to send parcels you need your usual PostNord customer agreement, for example MyPack Collect or MyPack Home.

VibeFox license key: bought on vibefox.net. One key works on one domain.

Installation

The module is one ZIP file. It is a Composer package and can also be copied into app/code. Run the commands in the Magento root folder as the user that owns the Magento files.

1. With Composer: put the ZIP file into a folder that your project uses as a Composer "artifact" repository and run composer require vibefox/module-postnord-shipping. Without Composer: unpack the ZIP file into app/code/Vibefox/PostnordShipping/, so that registration.php is directly in that folder.

2. Run bin/magento module:enable Vibefox_PostnordShipping and bin/magento setup:upgrade. In production mode also run bin/magento setup:di:compile and bin/magento setup:static-content:deploy, then bin/magento cache:flush.

3. In the Admin go to Stores > Configuration > Sales > Delivery Methods and open VibeFox PostNord. Paste your VibeFox license key into License key in the license block, the first row of the group, and click Activate (see License key).

4. Paste the PostNord API key, choose your Agreement country, fill in the Country prices (see Configuration), set Enable to Yes and click Save Config.

The module adds the PostNord shipping method to Magento with two options. Customers see them as PostNord - Service point (delivery to a service point, on by default) and PostNord - Home delivery (delivery to the address, off until you set Home delivery to Yes). The method is off after installation (Enable = No). The module stores the chosen service points in its own table.

Configuration

All settings are in Stores > Configuration > Sales > Delivery Methods > VibeFox PostNord, in the standard Magento configuration form. Like other Magento settings, they can be changed for a website with the Scope switcher at the top of the page; Method title, Service point name and Home delivery name also for a store view. Remove data on uninstall is read from the Default Config only. Save Config saves the whole page; every save of a PostNord setting also clears the cached service point lists. Amounts and weights accept "9.99" and "9,99".

If a value is wrong, Magento shows an error and nothing on the page is saved: an empty Method title, Service point name or Home delivery name, longer than 64 characters or with one of the characters < > ; = # { }; a Sort order that is not a whole number; a Min weight (kg) greater than the Max weight (kg). A cost, subtotal or weight that is not a number of 0 or more is cleared with a message, and the other settings are saved.

While Enable is Yes, warnings after saving remind you when no API key is saved (service point delivery then uses the nearest point) and when no prices are configured (delivery is hidden until a price or the free shipping threshold applies). The warnings are shown only while the method is enabled, because the Delivery Methods page is shared by all shipping methods.

General

Enable: shows or hides PostNord at checkout. Default: No.

Method title: the carrier name shown in the cart and at checkout. Default: PostNord. Required, at most 64 characters.

Service point delivery: offers delivery to a PostNord service point, with the picker. Default: Yes.

Service point name: shown after the method title, as "Method title - Service point name", for example "PostNord - MyPack Collect". Default: Service point. Required, at most 64 characters.

Home delivery: also offers PostNord home delivery, without a service point. Default: No.

Home delivery name: shown after the method title for home delivery, for example "PostNord - MyPack Home". Default: Home delivery. Required, at most 64 characters.

Sort order: the position among the shipping methods at checkout. A whole number, negative numbers are allowed.

The module has no tax field. If your store charges tax on shipping, set it in Stores > Configuration > Sales > Tax > Tax Classes > Tax Class for Shipping.

PostNord API (service point picker)

API key: the API key of your application on developer.postnord.com. It is sent to PostNord only from your server, never to the browser, and is never written to the log. Magento stores it encrypted and shows only a mask after saving. Leave the mask as it is to keep the saved key, type a new value to change it. To delete the saved key, clear the field and click Save Config.

Test mode: uses the PostNord test environment (atapi2.postnord.com). Only for keys issued for the test environment. Default: No.

Agreement country: the country of your PostNord customer agreement: Sweden, Denmark, Norway or Finland. It decides which service points are offered. Delivery country (default) uses the customer's country.

Prices

Prices are in the base currency of your store, tax excluded, and the same for both options. Magento shows them in the customer's currency. PostNord has no public price API, so you set your own prices, typically your PostNord agreement prices. The order is: free shipping threshold, then the country table, then the fallback cost.

Calculation type: Per order (default) charges the price once. Per item multiplies it by the number of items in the cart.

Country prices: a price by destination country and cart weight. Click Add country to add a row and Delete to remove one. Each row has a Price and weight columns: XS up to 1 kg, S up to 2 kg, M up to 3 kg, L up to 5 kg and XL above 5 kg. A weight column with 0 uses the Price column, and a Price of 0 means free shipping. Country * All other countries covers every country without its own row. If a country has several rows, the first one is used. An empty cell is saved as 0. A cell that is not a number is saved as 0, with the message "PostNord: invalid price cells were saved as 0; valid prices were saved."

Fallback cost: used when the country table has no row for the destination and no * row. Leave it empty to hide PostNord for such countries.

Free shipping from: the cart subtotal (products that need shipping, after discounts, before tax, in the base currency) from which PostNord is free. It applies before the price lookup, after the weight and subtotal restrictions, so it also applies to a country without a price row. Leave it empty to never offer free shipping.

Availability

Min weight (kg): hides PostNord when the cart weighs less. Default: 0, which means no limit.

Max weight (kg): hides PostNord when the cart weighs more. 0 or empty means no limit. Default: 30 kg. Check the weight limit of your PostNord service: parcel lockers accept less than service points.

Minimum subtotal: shows PostNord only if the cart subtotal (products that need shipping, after discounts, before tax) is at least this amount. Leave it empty to always show it.

Product weights are converted to kg from the weight unit of your store (Stores > Configuration > General > General > Locale Options > Weight Unit, lbs or kgs). Magento products have no standard dimensions, so volumetric weight is not calculated.

Ship to Applicable Countries: Specific Countries (default) offers PostNord only for the countries below, All Allowed Countries for every country your store allows.

Ship to Specific Countries: the destination countries for Specific Countries. Default: Sweden, Denmark, Norway and Finland. If you clear the list, PostNord is not offered for any country. The service point picker is shown for these four countries only; for other countries the options are offered with your prices, without a picker.

Advanced

Debug log: writes rate calculations and API calls to var/log/vfd_ptnd_debug.log.php in the Magento folder. The file cannot be opened from the web and is rotated at 5 MB. API errors are always logged, even when this is off. The API key is never logged. Turn the log off when you are done.

Debug log contents: shows the size and the latest entries of the log. Click Clear log to empty it.

Remove data on uninstall: when Yes, uninstalling the module with its data deletes the PostNord settings, the log and the service point choices of carts that were never ordered (see Uninstall). The license key and the cached lists are always removed. Service points saved in orders are never deleted.

How it works at checkout

At the shipping step Magento asks the module for the PostNord prices. Only products that need shipping count: virtual and downloadable products add no weight and are not included in the subtotal. The module checks the countries, the cart weight and the minimum subtotal. If free shipping applies, the price is 0. Otherwise the price comes from the country table, then from the fallback cost. If there is no price, the option is hidden. A Magento cart price rule with free shipping also makes the price 0, while the weight, subtotal and country limits still apply. The price calculation never calls PostNord.

For the service point option and a delivery address in Sweden, Denmark, Norway or Finland, your server asks the PostNord Business Location API for the 10 service points nearest to the delivery postcode. It sends the delivery country and postcode and the agreement country. The API timeout is 10 seconds. Lists are cached for 6 hours per postcode, and "no points" answers for 1 hour. API errors are cached for 5 minutes, so a PostNord outage does not slow down every checkout update. The list is loaded only after the customer selects the service point option.

The home delivery option never shows a picker.

The module does not request live PostNord prices and does not create shipping labels, book shipments (EDI), provide tracking numbers or send tracking e-mails. There is no map view. Use PostNord Portal, Skicka Direkt Business or a label tool for shipments; the saved service point ID is what those tools need.

Pickup points

When the customer selects PostNord - Service point, a PostNord service point list appears under the shipping methods with the nearest points, grouped by city with distance. The choice is saved with the cart right away and is shown under the list. When the delivery country or postcode changes, the list is loaded again; a point chosen for another postcode is not used.

When the list is loaded, a point is required. Without one, Next stops with "Please choose a PostNord pickup point." The chosen point is checked against PostNord's list for the delivery address on the server, again when the shipping step is saved ("Please select a PostNord service point.") and again when the order is placed. The name, address and ID are always taken from PostNord's list.

The picker never blocks a sale. If the list cannot be loaded (no API key yet, PostNord API down, no points near the postcode), the customer sees "PostNord will deliver to the service point nearest to the shipping address." and can still place the order.

If the customer leaves the payment page of a payment method and Magento restores the cart (for example after a cancelled payment), the customer can choose a service point again and place the order. The earlier order keeps its own point, and the new order gets the newly chosen one.

Order: the shipping description of the order shows the point after the method name, for example "PostNord - Service point: name — address (ID SE-091234)". Magento shows this description in the order e-mails and on the order pages.

Admin order page: on Sales > Orders > View, Information tab, the PostNord service point block shows the name, address and Service point ID. If no point was chosen, it says "Not selected — PostNord delivers to the service point nearest to the shipping address."

Order page of the customer: the order in the customer's account (or on the Orders and Returns page for guests) shows the same PostNord service point block.

The blocks also work for older orders and when the module is switched off. Service point choices of carts that were never ordered are cleaned up after 30 days; the points of orders are never deleted.

License key

The module works with a VibeFox license key from vibefox.net. The license block License — VibeFox PostNord is the first row of the VibeFox PostNord group in Stores > Configuration > Sales > Delivery Methods, above the settings. Paste the key into License key and click Activate. After that the block shows the key masked, the status (for example the date the license is active until and your domain) and the buttons Check now to check the status again, Change key to enter another key and Remove key to remove the key from this store. Below them are the line Product: magento-shipping-postnord and the link Manage licenses and domains in your account, which opens your vibefox.net account. Only Admin users whose role allows the Delivery Methods configuration section can change the key. The texts of the block follow the Admin interface locale (English and Russian are included).

If the key is not accepted, the block says why, for example Key not found, This key belongs to another product, Domain limit reached or License expired on a date. After the store address changes, or after you free a domain slot in your account, click Check now. If the license server cannot be reached, the module keeps working on the last known status.

One key works on one domain: the domain of the default store view, also when the installation has several websites or stores. Removing the key from the store does not free its domain slot. Free the slot in your vibefox.net account.

Without an active key, the PostNord options are not shown to customers at checkout and no price is calculated. The Magento storefront does not know that you are logged in to the Admin, so the options are hidden for you too: you can set up the module before you buy a key, but not test it at checkout. A reminder appears in the System Messages of the Admin, with the links Enter the license key and Dismiss, which hides it for 7 days. Existing orders are not affected.

When a license expires, the module keeps working, but updates and support need a renewal. The status is checked again automatically: once a day for the first 14 days after the key is entered, then once a week, by the Magento cron and while you work in the Admin. Uninstalling the module with its data always removes the license key and license status.

Troubleshooting

PostNord does not appear at checkout: check that the license is active and Enable is Yes for the website of the store, and that Service point delivery or Home delivery is Yes. Check Ship to Applicable Countries and Ship to Specific Countries, that a price is set for the country (country row, * row or Fallback cost), the weight limits and Minimum subtotal.

The picker says service points cannot be loaded: check the API key and the Test mode setting. A production key does not work against the test environment, and the other way round. Turn on Debug log, reload the checkout and look at the Debug log contents field in the settings. The order can still be placed; PostNord then delivers to the nearest service point.

Unexpected service points: check Agreement country. It decides which service points are offered.

Shipping is free by mistake: check Country prices for rows with a Price of 0, especially a * row added with Add country and left unfilled, check Free shipping from and your cart price rules with free shipping.

Service points look outdated after a change: click Save Config on the Delivery Methods page. This clears the cached lists.

The settings page or the checkout looks unchanged after installing or updating: run bin/magento setup:upgrade and bin/magento cache:flush; in production mode also setup:di:compile and setup:static-content:deploy.

Uninstall

Deleting the module code alone removes nothing from the database: the license key and the settings stay. To remove the data, uninstall the module with the Magento command:

Installed with Composer: run bin/magento module:uninstall --remove-data Vibefox_PostnordShipping. It removes the data and the code.

Installed in app/code: run bin/magento module:uninstall --non-composer Vibefox_PostnordShipping to remove the data, then bin/magento module:disable Vibefox_PostnordShipping, delete the folder app/code/Vibefox/PostnordShipping and run bin/magento setup:upgrade.

The license key, the license status and the cached service point lists are always removed. If Remove data on uninstall is Yes, the PostNord settings, the log and the service point choices of carts that were never ordered are removed too. If it is No, the settings are kept for a re-install. Service points saved in orders are always kept.

PostNord is a trademark of its respective owner. This module is not affiliated with or endorsed by PostNord.