addInventoryPromotion
Creates or updates an account-level catalog promotion.
Input parameters
| promotion_id | int | (optional) Existing promotion identifier. Omit or pass 0 to create a promotion. |
| name | varchar(100) | Promotion name. Required when creating a promotion. |
| is_enabled | bool | Whether the promotion is enabled. Required when creating a promotion. |
| products_filter_type | int | Required when creating a promotion. 1 - all products with a price in the source price group, 2 - tags, 3 - categories, 4 - explicit product-price list. |
| products_filter_data | array | Filter payload for the selected products_filter_type. Type 1: omit this field. Type 2: tag ID array, e.g. [12, 18]. Type 3: category ID array, e.g. [3, 7]. Type 4: {"product_prices": {" |
| is_include_subcategories | bool | (optional) Include products from descendant categories. Used only when products_filter_type = 3. Ignored for other types. |
| source_price_group_id | int | Source price group identifier. Required for products_filter_type 1-3. Ignored when products_filter_type = 4 (stored as 0). |
| target_price_group_id | int | Independent target price group identifier. |
| duration_type | int | 0 - unlimited, 1 - bounded date range. Required when creating a promotion. |
| date_start | int | Promotion start timestamp. Required when duration_type = 1. Ignored when duration_type = 0 (stored as 0). |
| date_end | int | Promotion end timestamp. Required when duration_type = 1. Ignored when duration_type = 0 (stored as 0). |
| price_multiplier | float | Multiplier applied to the source price (e.g. 0.8 means -20%). For products_filter_type 1-3 at least one of price_multiplier or price_addition is required. Ignored when products_filter_type = 4 (stored as 1). |
| price_addition | float | Amount added after applying the source multiplier. Can be negative. For products_filter_type 1-3 at least one of price_multiplier or price_addition is required. Ignored when products_filter_type = 4 (stored as 0). |
| price_round | int | (optional) Price rounding after the multiplier and addition: 0 - without rounding, 1 - round up to the full amount, 2 - round down to the full amount, 3 - round up to .99, 4 - round down to .99, 5 - round up to the nearest 0.09, 6 - round down to the nearest 0.09, 7 - round up and down with an accuracy of 0.09, 8 - round to the nearest 0.10, 9 - round units to closest 5. Ignored when products_filter_type = 4 (stored and returned as 0). |
| csv_identifier | varchar(10) | Identifier type used as keys in products_filter_data.product_prices: id or sku. Required when products_filter_type = 4. Ignored for other types. |
Output data
The method returns the data in JSON format.
| status | varchar(30) | SUCCESS - request executed correctly ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code |
| promotion_id | int | Created or updated promotion identifier. |
Sample
Input data:Output data:
A sample request in PHP: