shop.product.add

Adds a new product.

Parameters

  • name POST

    Product name.

  • type_id POST

    Product type ID.

  • summary POST Optional

    Brief description.

  • description POST Optional

    Full description.

  • meta_title POST Optional

    TITLE element for product page in storefront.

  • meta_keywords POST Optional

    META keywords value.

  • meta_description POST Optional

    META description.

  • og POST Optional

    Associative array of product properties for social media and online messengers. Examples of allowed array keys are 'title', 'description', 'video', 'image_id'.

  • status POST Optional

    Publication status: -1 (unpublished), 0 (hidden), 1 (published).

  • image_id POST Optional

    Default image ID.

  • sku_id POST Optional

    Default variant ID.

  • video_url POST Optional

    Video URL.

  • url POST Optional

    Editable part of the product page URL in the storefront.

  • currency POST Optional

    3-letter currency code.

  • tax_id POST Optional

    Tax rule ID.

  • cross_selling POST Optional

    Recommended products selection mode (cross-selling). 0: disabled, 1: automatic selection, 2: manually selected recommended products.

  • upselling POST Optional

    Recommended products selection mode (upselling). 0: disabled, 1: automatic selection, 2: manually selected recommended products.

  • badge POST Optional

    Id of selected default badge or HTML code of custom badge.

  • sku_type POST Optional

    Product variants selection mode for the storefront: 0 (by SKU names), 1 (by feature values). Default value is 0.

  • stock_base_ratio POST Optional

    Stock-to-base quantity unit ratio. If not specified then product type setting is applied by default.

  • order_count_step POST Optional

    Quantity adjustment value with “+/-” buttons. If not specified then product type setting is applied by default.

  • order_count_min POST Optional

    Minimum orderable quantity. If not specified then product type setting is applied by default.

  • skus POST Optional

    Product variants data array. Required for the case when the 'sku_type' parameter contains value '0'. Array keys are variants’ IDs, array values are sub-arrays with variants’ properties:

    - available (int) Flag (0 or 1) of the availability for purchase.
    - status (int) Flag (0 or 1) of the visibility in the storefront.
    - price (float) Price in the decimal(15,4) format.
    - purchase_price (float) Purchase price in the decimal(15,4) format.
    - compare_price (float) Strike-through price in the decimal(15,4) format.
    - name (string) Name.
    - stock_base_ratio (float) Stock-to-base quantity unit rationin the decimal(16,8) format.
    - order_count_min (float) Minimal orderable quantity in the decimal(15,4) format.
    - order_count_step (float) Value of the quantity adjustment with “+/-” buttons in the decimal(15,4) format.
    - stock (array) Variant’s stock quantities. If no stocks are set up in the store settings then the array must contain 1 item with the Variant’s stock quantity in the decimal(15,3) format. If stocks are set up then array keys must be stock IDs and array values must be quantities available on those stocks in the decimal(15,3) format.
    - features (array) Variant’s feature values. Array keys must be features identifiers (strings) and array values must be corresponding features’ values.

  • features POST Optional

    Product features values array. You can view an example of this array structure by means of developer tools in a browser when a product is being saved in the store backend.

  • features_selectable POST Optional

    Array of feature values to generate product variants from all their combinations. Array keys must be features’ string identifiers, array values must be sub-arrays containing those features’ value IDs. Can be used with the 'sku_type' parameter set to '1'.

  • base_price_selectable POST Optional

    Price to be applied to all product variants generated from the 'features_selectable' parameter value.

  • compare_price_selectable POST Optional

    Strike-through price to be applied to all product variants generated from the 'features_selectable' parameter value.

  • purchase_price_selectable POST Optional

    Purchase price to be applied to all product variants generated from the 'features_selectable' parameter value.

  • categories POST Optional

    Array of product’s categories’ IDs. The first ID in the array is saved as product’s main category ID.

  • tags POST Optional

    List of tags, which must be associated with the product, separated by commas as one string or as an array.

  • params POST Optional

    Extra product parameters as an associative array or as a string of the form 'name1=value1\nname2=value2\n...' in which name/value pairs must separated with newline characters. If null is passed instead then all extra parameters of the specified product will be deleted.

  • sets POST Optional

    Array with the information about static sets in which the product must be included. Array items must be either set IDs or sub-arrays, each containing a single 'id' key with the corresponding set ID. If a product was contained in some sets then it is automatically excluded from those whose IDs are not specified in this parameter.

  • access_token GET

    API auth token obtained during the API authorization.

  • format GET Optional

    Sets response format. Available options: json (default), xml.

Error codes

  • invalid_request

    Invalid formed request. Additional information about the error is available in error_description parameter.

  • access_denied

    Access to the specified API method for the current token is denied.

  • invalid_method

    Unknown API method.