Working with Product Assets
How assets are managed on products, including main image handling, variant inheritance, and asset operations.
This page explains how assets are attached to products and the various operations available for managing product assets.
Product Asset Properties
Products contain assets through two properties:
| Property | Type | Description |
|---|---|---|
MainImageUrl | string | URL to the primary product image |
Assets | List<Asset> | Collection of all product assets |
Relationship Between MainImageUrl and Assets
The MainImageUrl and Assets properties are synchronized:
- When an asset has
IsMainImage: true, itsUrlis copied toMainImageUrl - When
MainImageUrlis set independently, a corresponding asset is created - Only one asset should have
IsMainImage: trueat a time
Adding Assets to Products
Via API
Add assets when creating or updating products:
Asset ID Matching
When adding assets, existing assets with matching AssetId are replaced:
If the product already has an asset with that assetId, it will be replaced.
Updating Asset Metadata
Update asset properties without re-uploading the file:
Updatable Properties
| Property | Update Behavior |
|---|---|
Name | Set to empty string to clear, or new value to update |
Description | Set to empty string to clear, or new value to update |
AltText | Set to empty string to clear, or new value to update |
Purpose | Set to empty string to clear, or new value to update |
SortOrder | Any value updates the sort order |
Properties | Entire list is replaced |
IsMainImage | Updates main image designation |
Deleting Assets
Remove assets from a product by specifying asset IDs to delete:
When assets are deleted:
- Asset is removed from the product's
Assetslist - File is deleted from storage
- Associated preview images are also deleted
Asset deletion is permanent. The file is removed from storage and cannot be recovered.
Variant Asset Handling
Product variants can have their own assets or inherit from the parent product.
Asset Inheritance
When processing products with variants:
- Parent product assets are uploaded first
- Variant assets are processed with access to parent URLs
- Identical external URLs are only uploaded once (deduplication)
Example: Variant with Shared Assets
In this example:
shirt-main.jpgis uploaded once and shared between parent and blue variantshirt-red.jpgis uploaded separately for the red variant
Variant-Specific Assets
Each variant can have unique assets:
Main Image Management
Setting the Main Image
The main image can be set in two ways:
1. Via IsMainImage flag:
2. Via MainImageUrl:
IsMainImage Synchronization
After asset processing, Omnium ensures:
- Only one asset has
IsMainImage: true - The asset with
IsMainImage: truehas its URL matchingMainImageUrl - Other assets have
IsMainImage: false
Changing the Main Image
To change the main image:
The previous main image's IsMainImage is automatically set to false.
Asset Processing Flow
When products are saved with external URLs, the following processing occurs:
Virtual Folder Naming
Assets are organized using virtual folders:
The virtual folder name is determined by:
Product.ProductIdif availableProduct.Idas fallback
Deduplication
Omnium deduplicates asset uploads within a product save operation:
How It Works
- A dictionary tracks
ExternalUrl → InternalUrlmappings - Before uploading, check if external URL exists in dictionary
- If found, reuse the internal URL without re-uploading
- This prevents duplicate uploads for shared images across variants
Benefits
- Reduces storage usage
- Faster product processing
- Consistent URLs across variants
Example
Result: shared.jpg is uploaded once and both variants reference the same internal URL.
Force Upload
To re-upload an asset that already has an internal URL, use ForceUpload:
Use cases:
- Image was updated at the source
- Need to regenerate preview images
- Fixing corrupted uploads
