The WordPress Products API returns JSON that contains all data. In the result are included the tags, the categories, the images and all fields. You could display the product info with one API call.
The URL is formed like this: https://<wp>/wp-json/wc/store/products.
The fields here are:
- id: Integer
- name: String
- description: String (HTML) – the explanation of the product
- short_description: String (HTML) – a short version. In the admin interface – it is usually located below the main content.
- tags and categories arrays with objects containing:
- id: Integer
- slug: String – URL friendly variation of the name
- name: String
- link: String – the URL that will filter the products by tags or categories (the browser version, not the JSON). To filter the products in the JSON, you must append request parameters category or tag with value – the id.
- images array containing objects with fields:
- thumbnail: String – small version of the image
- sizes: String – a CSS description of the size. Something like “(max-width: 250px) 100vw, 250px“
- src – the URL pointing to the image.
- alt- the accessibility string
- id: Integer – the id of the image
- srcset: Useful for rending images in the browser. This property will let the it pick the most appropriate image depending on the screen size.
- prices object with several fields related to money like – currency information, promotional and several others:
- regular_price – the original price of the product
- price – The price that the product sells in the current moment.
- currency_code – the ISO standard currency code
- currency_minor_unit: Integer – the number of decimal numbers. Usually you may need to divide the price to 10 powered to this number.
- currency_symbol – the ISO standard – currency symbol
- reviews_count: Integer – number of reviews
- average_rating: Double – the average of the reviews
- on_sale: Boolean – is the product available for sell
- is_in_stock – is the product in stock
- attributes – attributes of the product – entered in the admin interface
- quantity_limit – limit to the number of quantities in a single order
- variation: String – the current variation of the product
- variations: Array – some products may have variations – by color, by size, by many more characteristics that the user may pick from.
An example usage of the WordPress Products API is available at the following address: https://programtom.com/dev_examples/wp_products/ – implemented using Flutter – build for the Web Browser.
By default the Items for sell are global – there is no user association. If you want to convert WordPress to Marketplace, you should search for Plugin or extend it on your own.