Skip to main content

Magento Product Variant from iPaaS

Update Magento product variants from iPaaS

Updated over 2 weeks ago

Overview

Magento Simple Associated Product Variant Inventory Totals mapping is designed to update inventory totals for associated simple product variants in Magento based on data from iPaaS.com. This mapping supports the automated synchronization of Product Variant records from iPaaS into Magento via the Product Variant API.

Mapping Collection Status

  • Mapping Status: Enabled.

  • Trigger Events: The sync is triggered by the update of inventory totals in Magento.

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

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

System Caveats

Magento Caveats

  • Receives updated stock quantities, stock status, and last update timestamps for associated variants.

  • Automatically adjusts stock visibility on the storefront after synchronization.

iPaaS.com Caveats

  • Executes this mapping only when the SecondaryUpdate condition is satisfied.

  • Handles inventory recalculation and variant-level stock rollups before sync

  • Ensures that AlwaysInStockOverride flags are properly transferred to maintain manual in-stock overrides where necessary.

Setup Requirements

Magento Configuration

  • Sku: Must match an existing Magento product variant SKU.

  • StockItemQty: Represents the recalculated total quantity across associated variants.

  • StockItemIsInStock: Determines whether the product is in stock or out of stock.

  • AlwaysInStockOverride: Boolean flag indicating if the variant should remain in stock regardless of available quantity.

iPaaS.com Configuration

  • QtyAvailable: Numeric value indicating available quantity for the variant.

  • SecondaryUpdate: Boolean field used to control when this mapping executes.

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. Trigger Evaluation: The mapping is executed only when SecondaryUpdate == true.

  2. Data Retrieval: iPaaS retrieves variant records requiring inventory total updates.

  3. Filter Application: The filter ensures that no record processes unless explicitly flagged for secondary update.

  4. Field Mapping: SKU, stock quantity, stock status, and override flags are prepared.

  5. Sync Execution: iPaaS sends the mapped data to Magento using the Product Variant Inventory Update API.

  6. Magento Update: Magento applies the updates, recalculates stock visibility, and records the last update timestamp.

Mappings

Magento Product Variant From iPaaS

Filter

1 == 0 && SecondaryUpdate == true

Mapping Type

Source (iPaaS.com)

Destination (Magento)

Field

Sku

Sku

Dynamic Formula

CurrentDateTime()

UpdatedAt

Dynamic Formula

var result = await SumInventoryForVariantAsync(ConvertToLong(Id)); return Floor(result);

StockItemQty

Dynamic Formula

var result = await SumInventoryForVariantAsync(ConvertToLong(Id)); var result2 = Floor(result); (result2 <= 0 ? return false; : return true;)

StockItemIsInStock

Field

Child Always In Stock (custom field)

AlwaysInStockOverride

Error Handling

Collection: Simple Associated Product Variant Inventory Totals Update

Invalid Quantity Value

  • Description: The computed StockItemQty is invalid (null, negative, or non-numeric).

  • Resolution: Review inventory calculation logic and confirm numeric output.

Invalid Stock Status

  • Description: The StockItemIsInStock formula did not return a valid Boolean value.

  • Resolution: Validate that stock status formulas resolve correctly to true or false.

Validation Rules & Testing

Validation Checklist

  • SecondaryUpdate flag correctly identifies eligible records (true = process).

  • Quantity (StockItemQty) returns a valid numeric value.

  • Stock status correctly reflects Magento’s in-stock/out-of-stock rules.

  • AlwaysInStockOverride is respected when set to true.

  • UpdatedAt timestamp populates correctly during each sync.

Test Scenarios

  1. Sync with SecondaryUpdate = false: Verify no record is processed.

  2. Sync with valid data and SecondaryUpdate = true: Confirm Magento updates stock totals successfully.

  3. Missing SKU: Expect “Missing SKU” error.

  4. Negative or null quantity: Expect “Invalid Quantity Value” error.

  5. AlwaysInStockOverride = true: Verify product remains in stock regardless of actual quantity.

Additional Notes

  • The 1 == 0 condition prevents unintended executions and ensures the mapping runs only during controlled secondary updates.

Did this answer your question?