Skip to main content

Magento Product Inventory from iPaaS

Transfer product inventory from iPaaS to Magento

Updated over 2 weeks ago

Overview

Magento Product Inventory can be transferred from iPaaS.com using an Add/Update sync method. This mapping supports the automated synchronization of Product Inventory records from iPaaS into Magento via the Product Inventory API.

Mapping Collection Status

  • Mapping Status: Enabled.

  • Trigger Events: The sync is triggered by the creation or update of Product Inventory in Magento.

  • ID Format: When manually syncing, the Product Inventory ID from iPaaS is used.

  • Conflicting Mappings: This mapping applies only to Product Inventory. Ensure no other mappings target the same Magento entity to prevent data from being overwritten.

System Caveats

Magento Caveats

  • The target product must already exist in Magento for inventory updates to succeed.

  • Magento validates both SKU and Source Code before applying inventory changes.

  • The Status field determines stock availability, where 1 = In Stock and 0 = Out of Stock.

iPaaS.com Caveats

  • Only records with a valid Magento Product External ID are processed.

  • Products without valid external references are automatically skipped.

  • If QtyAvailable is missing or invalid, the sync may fail validation.

Setup Requirements

Magento Configuration

  • SKU: Must match an existing Magento product SKU.

  • SourceCode: Represents the warehouse or location code; must exist in Magento.

  • Quantity: Numeric field representing available quantity.

  • Status: Determines if the product is in stock or out of stock based on quantity.

iPaaS.com Configuration

  • ParentId: Used to resolve the corresponding Magento product via GetExternalIdAsync.

  • QtyAvailable: Numeric value indicating available inventory for the product.

  • SpaceportSystemId: Identifies the connected Magento system for proper ID resolution.

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

  1. Retrieve Data: iPaaS retrieves product inventory records for real-time updates.

  2. Filter Products: The mapping filter ensures only existing Magento products are processed.

  3. Map Fields: SKU, Source Code, Quantity, and Status are mapped to Magento fields.

  4. Validate Inventory Data: Ensures quantity and stock status meet Magento’s data requirements.

  5. Sync Inventory: iPaaS sends the mapped data to Magento via the Realtime Inventory API.

Mappings

Magento Product Inventory From iPaaS

Filter

var external = await GetExternalIdAsync(ParentId, "Product", SpaceportSystemId);
if(!IsEmpty(external)){return true;} else {return false;}

Mapping Type

Source (iPaaS.com)

Destination (Magento)

Dynamic Formula

return await GetExternalIdAsync(ParentId, "Product", SpaceportSystemId);

Sku

Lookup Translation

SourceCode

Field

QtyAvailable

Quantity

Dynamic Formula

(QtyAvailable <= 0 ? 0 : 1)

Status

Lookup Translation

M2 Product Inventory Source Code From iPaaS

Source (iPaaS.com)

Destination (Magento)

LocationId==LocationIdFromName("MAIN").Value

MAIN

LocationId==LocationIdFromName("EAST").Value

EAST

LocationId==LocationIdFromName("STORAGE").Value

STORAGE

Error Handling

Collection: Product Inventory (Parent)

Missing Product Reference

  • Description: The product record does not exist in Magento, causing GetExternalIdAsync to return null.

  • Resolution: Ensure that the product has been successfully created and synced before sending inventory updates.

Invalid Quantity Value

  • Description: The QtyAvailable field contains an invalid or non-numeric value.

  • Resolution: Confirm that QtyAvailable is a valid numeric type in the iPaaS payload.

Lookup Translation Failure

  • Description: The Source Code lookup could not resolve a valid Magento location.

  • Resolution: Verify the “M2 Product Inventory Lookup” mapping contains correct warehouse codes

Validation Rules & Testing

Validation Checklist

  • Product exists in Magento (External ID resolved correctly).

  • SKU and Source Code match valid Magento records.

  • Quantity is numeric and positive.

  • Status updates reflect correct in-stock/out-of-stock logic.

Test Scenarios

  1. Update inventory for an existing Magento product: Verify stock quantity updates successfully.

  2. Send record for non-existing product: Confirm it is skipped by filter.

  3. Send record with QtyAvailable = 0: Product should be marked out of stock.

  4. Invalid Source Code mapping: Expect “Lookup Translation Failure” error.

Additional Notes

  • If inventory updates are required for new products, ensure the Add/Update Product mapping is executed first.

Did this answer your question?