conneqt / m2-base
Conneqt Base Module for Magento 2
Package info
git.dev.epartment.nl/conneqt/m2/base.git
Type:magento2-module
pkg:composer/conneqt/m2-base
Requires
- php: ^8.1
- magento/framework: >=101.0.0
This package is auto-updated.
Last update: 2026-06-05 13:46:47 UTC
README
Conneqt_Base is the foundation module for the Conneqt Magento 2 integration.
In short, it adds a custom order import API and a set of Magento plugins, observers, and overrides that make Magento behave better when data is being synchronized from an external system. The module mainly focuses on:
- importing orders through a custom REST endpoint
- handling bundled product selections on imported order items
- adjusting customer and address updates for integration use cases
- controlling inventory reservation and source deduction behavior
- customizing product URL key and product update behavior
What this module does
The module introduces a custom REST endpoint at POST /V1/conneqt_orders.
That endpoint accepts an order payload and turns it into a Magento order by:
- creating or reusing a customer quote
- adding the incoming order items to the quote
- mapping bundled product selections to Magento bundle options
- filling billing and shipping addresses
- applying payment and shipping information
- placing the Magento order
- restoring totals and item prices from the external payload
- optionally linking the new order to an older Magento order when the payload represents an edit/replacement flow
Besides order import, the module also changes a few default Magento behaviors to better support external synchronization.
How it works
1. Custom order API
The main integration entry point is defined in:
etc/webapi.xmlApi/OrderInterface.phpModel/Api/Order.php
etc/webapi.xml exposes Conneqt\Base\Api\OrderInterface::placeOrder() as:
POST /V1/conneqt_orders
Model/Api/Order.php contains the actual order import workflow. It rebuilds the quote from the incoming order data, places the order, updates totals and line item amounts, and sends the order email at the end.
2. Extension attributes for imported order data
The module extends Magento order data with custom attributes in:
etc/extension_attributes.xmlApi/Data/BundledOptionInterface.phpApi/Data/BundledOptionSelectionInterface.phpModel/BundledOption.phpModel/BundledOptionSelection.php
These files let order items carry conneqt_bundled_options, so imported bundle products can be mapped to Magento's internal bundle option structure before the quote is placed.
3. Magento behavior overrides for integration requests
The module hooks into Magento through etc/di.xml, etc/webapi_rest/di.xml, and etc/events.xml.
These XML files register plugins, preferences, and observers that adjust Magento behavior during API-driven imports and updates.
Important files and what they do
| File | Purpose |
|---|---|
etc/module.xml | Declares the Conneqt_Base module. |
registration.php | Registers the module with Magento. |
composer.json | Composer package metadata and autoload configuration. |
etc/webapi.xml | Declares the conneqt_orders REST endpoint. |
Api/OrderInterface.php | Service contract for the custom order import API. |
Model/Api/Order.php | Main order import implementation. This is the most important file for understanding the order flow. |
etc/extension_attributes.xml | Adds extension attributes used during order import, including bundled option data. |
etc/di.xml | Registers service preferences and the main plugins used by the module. |
etc/webapi_rest/di.xml | Replaces Magento's REST controller and adds a product repository plugin for REST requests. |
etc/events.xml | Registers the order submission observer. |
Override/RestOverride.php | Overrides Magento's REST controller to turn some duplicate customer create requests into update requests. |
Observer/OrderSubmissionObserver.php | Prevents the standard new-order email for orders created through the Conneqt endpoint. |
Plugin/CustomerCustomAttributePlugin.php | Preserves existing customer custom attributes when an update payload omits them. |
Plugin/ExternalIdAddressUpdate.php | Treats an address save as an update when the same customer already has an address with the submitted external_id. |
Plugin/ProductRestApi.php | Prevents REST product updates from changing the attribute set unless allowed in config. |
Plugin/SourceDeductionServicePlugin.php | Optionally skips source deductions when shipping without available stock is enabled. |
Plugin/SourceItemsSavePlugin.php | Optionally clears reservations after source item updates. |
Plugin/InventoryReservationsApi/AllowOnlyOrderPlacedReservationsPlugin.php | Filters reservation events so only order_placed reservations are appended when the experimental mode is enabled. |
Model/ProductUrlPathGeneratorOverride.php | Customizes product URL key generation and supports SKU-based URL keys. |
Setup/Patch/Data/AddExternalIdCustomerAddressAttribute.php | Adds the external_id customer address attribute used by the address update plugin. |
etc/adminhtml/system.xml | Defines the module's admin configuration fields. |
etc/config.xml | Provides default configuration values. |
Key integration behaviors
Order import
The order import flow lives in Model/Api/Order.php.
A high-level summary:
- A quote is created for the customer from the incoming payload.
- Existing quote items are cleared.
- Incoming order items are added to the quote.
- If bundled options are present, they are translated into Magento bundle option data.
- Billing and shipping addresses are copied from the payload, or loaded from the customer defaults when needed.
- Shipping and payment information are saved.
- Magento places the order.
- The created order is updated with the external totals and item prices.
- If the payload refers to an existing Magento order, the new order is linked to it as an edited/replacement order and the old order is cancelled.
Customer create-to-update fallback
Override/RestOverride.php changes Magento's REST handling for a specific integration case.
When customer creation fails because the customer already exists, the module can convert the request into a PUT update request instead of returning the original failure immediately.
This behavior is protected by config and a password field defined in etc/adminhtml/system.xml.
Address matching by external ID
Plugin/ExternalIdAddressUpdate.php allows the integration to update a customer address without sending a Magento address entity ID.
If the submitted address contains a matching external_id for the same customer, the plugin loads the existing address and turns the save into an update.
Inventory and reservations
The inventory-related plugins help merchants whose stock is managed partly or fully outside Magento.
Plugin/SourceItemsSavePlugin.phpcan clear reservations after stock updates.Plugin/InventoryReservationsApi/AllowOnlyOrderPlacedReservationsPlugin.phpcan limit appended reservations toorder_placedevents.Plugin/SourceDeductionServicePlugin.phpcan skip source deductions when shipping without stock is allowed.
Product update behavior
The product-related customizations are:
Plugin/ProductRestApi.php: prevents unwanted attribute set changes through the REST API.Model/ProductUrlPathGeneratorOverride.php: changes how URL keys are generated, including optional SKU-based behavior.
Admin configuration
The module adds configuration under:
Stores > Configuration > CONNEQT > Base
The settings are defined in etc/adminhtml/system.xml.
The most important options are:
- reservation cleanup after stock updates
- experimental reservation filtering
- allowing shipment creation without enough stock
- allowing customer updates based on matching email
- allowing customer address updates based on
external_id - SKU-based product URL keys
- allowing or blocking attribute set changes through REST
Default values are defined in etc/config.xml.
Currently, allow_attribute_set_change defaults to enabled.
Setup patch
Setup/Patch/Data/AddExternalIdCustomerAddressAttribute.php adds the external_id customer address attribute used by the address matching logic.
This attribute is intended for admin customer address forms and supports integration-side address identity mapping.
Where to start when reading the code
If you are new to this module, read the files in this order:
etc/webapi.xmlApi/OrderInterface.phpModel/Api/Order.phpetc/di.xmlOverride/RestOverride.phpPlugin/etc/adminhtml/system.xmlSetup/Patch/Data/AddExternalIdCustomerAddressAttribute.php
That gives a good overview of both the public API and the Magento behaviors this module customizes.
Module name
- Magento module:
Conneqt_Base - Composer package:
conneqt/m2-base