API2Cart API v.1.1: Guideline on How to Work with Product Endpoints
First, we recommend you to explore the Product Methods documentation. Most methods support filters like modified_from, modified_to.
When working with shopping platforms that support multilanguage or/and multistore, you need to pass store_id and/or lang_id parameters. In case the parameter is not passed, we automatically set the default value of store_id and lang_id.
API2Cart returns response only for one language and one store in one request. To get the data for other stores or in other languages, send a request specifying other store_id and lang_id. Use cart.info method to retrieve the list of stores and languages if they are multiple.
Use product.count method to get the amount of products.
There can be the following types of products in product.list or product.info response: simple, virtual, configurable, bundle, grouped, downloadable, gift_card. For WooCommerce there are also supported simple-subscription і configurable-subscription product types.
Simple - a simple product that can be a standalone product or as a part of configurable, bundle or grouped product.
Virtual - a non-physical product like service, warranty, subscription. It can be a standalone product or a part of configurable or grouped types.
Configurable - a product that contains variants based on option combinations.
Bundle - a product that consists of separate products both physical and virtual. The customer can select which products and how many of them will form the final bundle product. This product type is often used in in electronics, e.g. cameras or computers.
Grouped - several separate products gathered into a group. You can find the ids of products included in a group in the grouped_products_ids massive in response of product.list or product.info. To get the info about these products, use product.list method specifying products_ids parameter. The parameter value must be unique ids that are in grouped_products_ids.
Downloadable - an electronic product that can be downloaded: multimedia or software.
Gift_card - a gift certificate of a certain value.
Simple-subscription and configurable-subscription are similar to virtual products. These types are used only in WooCommerce stores when WooCommerce Subscriptions module is active. Configurable-subscription type has variants.
To get variants or bundle items use product.child_item.list, specifying product_id or product_ids parameter to get list of child items of a certain product or few. If you specify “product_id=1”, the method will return child items for product with id=1, using product_ids parameter you can get list of child items for multiple products (max 100).
Product.child_item.list does not have a separate method for getting total number of child items. However, there is a total_count field in response that returns the total number of child items for a specific request with the specified parameters. For example, if you make two requests for the same product_ids, but in one request you specify avail_sale parameter, their total_count values can be different. There can be requests with zero count, in that case you can find out only the number of variants, for example “product.child_item.list.json?product_ids=a,b,c&count=0”.
Product.child_item.list method has a combination field in response, which contains option ids and their values that form a particular variant or bundle item. But not always all the options contained in the product form a combination of variants. Some platforms (like Magento or WooCommerce) allow custom options, that don’t form combination but allow to additionally customize the product, even if it has variants.
Use “params=force_all” parameter only when you really need all the available information. Otherwise, it is better to specify the needed fields, for example “params=id, name, price, advanced_price, quantity”.
Data retrieval order:
An example of data retrieval for products and their child items (variant, bundle items).
2) Call product.child_item.list specifying “product_ids” parameter