Overview
Magento Product Inventory Totals can be transferred from iPaaS.com using an Add/Update sync method. This mapping supports the automated synchronization of Product Inventory Totals records from iPaaS into Magento via the Product Inventory Totals API.
Mapping Collection Status
Mapping Status: Enabled.
Trigger Events: The sync is triggered by the update of Product Inventory Totals in Magento.
ID Format: When manually syncing, the Product Inventory Totals ID from iPaaS is used.
Conflicting Mappings: This mapping applies only to Product Inventory Totals. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.
System Caveats
Magento Caveats
Magento updates inventory totals directly through StockItemQty and StockItemIsInStock fields.
If AlwaysInStockOverride = true, stock visibility remains enabled regardless of total quantity.
The UpdatedAt timestamp field ensures Magento reflects the most recent synchronization time.
iPaaS.com Caveats
Calculates total inventory across all associated locations using the SumInventoryForProductAsync() function.
Executes only when SecondaryUpdate = true, ensuring that stock rollups are performed after location-level updates.
Excludes SKUs matching “GC-TEST-100” to prevent test records from triggering inventory updates.
Setup Requirements
Magento Configuration
Sku: Must match an existing product in Magento.
StockItemQty: Represents the total quantity of stock available for the product.
StockItemIsInStock: Boolean field controlling whether the product is marked in stock.
UpdatedAt: Used to record the timestamp of the last inventory update.
iPaaS.com Configuration
Id: Used by the SumInventoryForProductAsync() function to calculate cumulative product stock.
TrackingMethod: Must equal “Product” for inclusion in the inventory totals calculation.
SecondaryUpdate: Must be set to true for this mapping to execute.
AlwaysInStockOverride: Determines whether stock availability is manually overridden.
Authentication & Security
Magento2 API UserName: Used to access iPaaS API for fetching Company and related data.
Magento2 API Key: Used to access iPaaS API for fetching Company and related data.
Integration Flow
Retrieve Data: iPaaS identifies eligible Product records that satisfy the filter condition.
Calculate Totals: The system executes SumInventoryForProductAsync(Id) to aggregate all inventory quantities for the specified product.
Evaluate Stock Status: The stock status is recalculated based on the total quantity and override rules.
Map Fields: The calculated totals, stock state, and timestamp are mapped to corresponding Magento fields.
Sync Update: The updated data is transmitted to Magento’s product stock endpoints via API.
Mappings
Magento Product Inventory Totals From iPaaS
Filter
1==0 && TrackingMethod =="Product" && !(Sku == "GC-TEST-100") && SecondaryUpdate == true
Mapping Type | Source (iPaaS.com) | Destination (Magento) |
Field | Sku | Sku |
Dynamic Formula |
| UpdatedAt |
Dynamic Formula |
| StockItemQty |
Dynamic Formula | v | StockItemIsInStock |
Field | Parent Always In Stock (custom field) | AlwaysInStockOverride |
Error Handling
Collection: Product (Parent)
Missing SKU
Description: The SKU field is required for inventory updates.
Resolution: Ensure each iPaaS record contains a valid SKU referencing an existing Magento product.
SumInventoryForProductAsync Failure
Description: The total inventory calculation returned null or invalid data.
Resolution: Confirm that all child inventory records for the product exist and are accessible.
Invalid StockItemQty
Description: The calculated stock quantity is negative or non-numeric.
Resolution: Validate that inventory data in iPaaS is numeric and greater than or equal to zero.
Override Conflict
Description: The AlwaysInStockOverride flag conflicts with calculated quantity logic.
Resolution: Review override field values to ensure correct precedence during updates.
Validation Rules & Testing
Validation Checklist
SecondaryUpdate flag must be true.
StockItemQty calculated correctly from all related inventory sources.
AlwaysInStockOverride applied correctly when quantity is zero.
UpdatedAt timestamp reflects latest synchronization.
Test Scenarios
Recalculate totals for existing product: Verify Magento stock quantity updates successfully.
Set SecondaryUpdate = false: Confirm record is skipped.
Include product with AlwaysInStockOverride = true: Product should remain in stock regardless of quantity.
Additional Notes
This mapping performs update-only operations and does not create new Magento products.
