Have questions? Leave your message here or Schedule a quick call with our manager now

What is WPML and How API2Cart Works with It

WordPress site owners, including merchants running stores on WooCommerce, often use WPML to make their sites multilingual. 

WPML is made of a core plugin and add-ons. The API2Cart API returns data from the core plugin named WPML Multilingual CMS that manages the information organized by secondary modules like WPML Media, WPML Translation Management, and WPML String Translation

Note: it is obligatory that all the plugins including WooCommerce Multilingual are activated. Otherwise, the WPML information (wpml_info) might not be returned or returned partly.

Practical tips

To see what languages are active on a WooCommerce store, call the cart.info API method together with the force_all parameter. In the response, you will see them listed in the store_languages array. If the seller uses WooCommerce mutisite, store_languages is returned for the stores that use WPML.

Use the product.list method to get all the products available on the store translated into all the languages supported. The number of languages an item is translated to determines the number of products in the response. In simple terms, if an item is translated into 3 languages, you will see three separate products.

The same applies to product variants that are returned in the response of the product.variant.list method. 

You can filter products and variants by language using the language_id parameter.