Introduction
PWF Woocommerce Product Filters is fully integrated with the Woocommerce API version 3 to display products list for read-only using requests in JSON format and using the WooCommerce Authentication methods and standard HTTP verbs which are understood by most HTTP clients.
Authentication
The authentication is an important step to get products list when using filter items. because this plugin depends on Woocommerce API to get products list. [ more info here ].
Read more about the WooCommerce authenticate
Localhost: the Woocommerce API Authentication keys didn't work if your localhost website doesn't support SSL. So you need to use another authentication method you can use the plugin Basic Authentication.
Schema For a Filter Post
In this section, we will be cover :
- What is Schema?
- Plugin EndPoint.
- What is the data select parameter?
- The schema for items type [ checkbox - radio - text list - dropdown - color list - boxlist ].
- Data Display parameter.
- The schema for price slider item.
- The schema for date item.
What is Schema?
Please read this documentation.
Plugin EndPoint?
this schema it is displayed if you are using one of this HTTP Request:
https://example.com/wp-json/wp/v2/pwf_woofilter/<id>
https://example.com/wp-json/wp/v2/pwf_woofilter
wp-json/wc-pwfwoofilter/v1/filterproducts/?filter_id=294&min-price=20&max-price=80
What is data select parameter?
This parameter is an array or an empty array if your filter post contains many filter items [ category, color, size ]
and you send HTTP Request &category=1,2
So, date_select value is array(1,2) for category and empty for other filter items.
The schema for items type
[ checkbox - radio - text list - dropdown - color list - boxlist ]
Parameter | Type | Description |
---|---|---|
type | string | checkboxlist, radiolist, textlist, dropdownlist, colorlist, boxlist. |
title | string | Filter item title. |
url_key | string | Unique identifier for the filter item. |
source | String | related to the source of options in the WordPress admin when you edit the filter post. |
taxonomy | string | Represent taxonomy name depends on the source of options ex: product_cat, product_tag, or empty when you selected [ meta - orderby - author - stock status ]. |
multi_select | string | on or off, Available only for item types [ colorlist, boxlist, textlist ]. |
data_display | array | Represent elements to display in your API for each filter item. |
data_selected | array | if any filter item is sent using an HTTP request, these values found here. |
Data Display parmeter
You use this parameter to display their options in your frontend APP.
id: use it with filter item url_key to send HTTP requests.
name: display it for the end-user.
Available parameters for the data display option
Parameter | Type | Description |
---|---|---|
id | string/integer | if the source of options is [ category, taxonomy, attribute, tag ] the value in integer else is a string.
use this id when you send HTTP requests. |
name | String | the name of the item you can use it to display for the end-user. |
parent | integer | Available only for the source of options are [category, taxonomy ] use it if you need to display hierarchical. |
count | integer | the number of products that contain this item. |
type | string | Available only colorlist item, [ color or image ]. |
color | String | Available only for colorlist item, hexadecimal color ex: #222222. |
image | String | Available only for colorlist item, URL for image. |
bordercolor | String | Available only for colorlist item, hexadecimal color ex: #222222. |
marker | String | Available only for colorlist item, value can be[ light or dark ]. |
The schema for price slider item
There are two ways to use url_key here depend on the URL format you select when you edit price slider item.
- Parameters through a dash Use url_key here like &price=2-80
- Two parameters Use url_key_min_price, url_key_max_price ex: &min-price=20&max-price=80
Parameter | Type | Description |
---|---|---|
type | string | priceslider. |
title | string | filter item title. |
url_key | String | Unique identifier for the filter item. |
url_key_min_price | string | Unique identifier for min price. |
url_key_max_price | string | Unique identifier for max price. |
price_url_format | string | two or dash. |
data_display | array | Empty for now not important. |
data_selected | array | Contain min price and max price or empty if HTTP request doesn't have this filter. |
The schema for date item
When you request filter products by date, date format "YYYY-MM-DD"
Parameter | Type | Description |
---|---|---|
type | string | date. |
title | String | filter item title. |
url_key_date_before | String | Unique identifier for date after. |
url_key_date_after | String | Unique identifier for date before. |
min_max_date | object | contain min and max date for products min_date, max_date. |
data_display | array | Empty for now not important. |
data_selected | array | contain date before and date after. |
Retrieve a Filter Post
JSON response example:
{
"id": 303,
"title": "API Filter",
"filter_items": [
{
"type": "checkboxlist",
"title": "Category",
"url_key": "catgory",
"source": "category",
"taxonomy": "product_cat",
"data_display": [
{
"id": 16,
"name": "Accessories",
"parent": 0,
"count": 8
},
{
"id": 17,
"name": "Clothing",
"parent": 0,
"count": 12
}
]
},
{
"type": "textlist",
"title": "Brands",
"url_key": "brand",
"source": "taxonomy",
"taxonomy": "pwb-brand",
"multi_select": "on",
"data_display": [
{
"id": 49,
"name": "cninja",
"parent": 0,
"count": 5
},
{
"id": 51,
"name": "premium",
"parent": 0,
"count": 5
}
]
},
{
"type": "radiolist",
"title": "Season",
"url_key": "season",
"source": "attribute",
"taxonomy": "pa_season",
"data_display": [
{
"id": 0,
"name": "Show all",
"parent": 0,
"count": 0
},
{
"id": 29,
"name": "Summer",
"parent": 0,
"count": 7
},
{
"id": 30,
"name": "Winter",
"parent": 0,
"count": 7
}
]
},
{
"type": "colorlist",
"title": "Colors",
"url_key": "color",
"source": "attribute",
"taxonomy": "pa_color",
"multi_select": "on",
"data_display": [
{
"id": 27,
"name": "Blue",
"parent": 0,
"count": 8,
"type": "color",
"color": "#1e73be",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 60,
"name": "Brown",
"parent": 0,
"count": 2,
"type": "color",
"color": "#8b4513",
"image": "",
"bordercolor": "",
"marker": "light"
}
]
},
{
"type": "boxlist",
"title": "Size",
"url_key": "Size",
"source": "attribute",
"taxonomy": "pa_size",
"multi_select": "on",
"data_display": [
{
"id": 35,
"name": "10",
"parent": 0,
"count": 4
},
{
"id": 33,
"name": "11",
"parent": 0,
"count": 1
}
]
},
{
"type": "dropdownlist",
"title": "Tags",
"url_key": "tag",
"source": "tag",
"taxonomy": "product_tag",
"data_display": [
{
"id": 52,
"name": "Fashion",
"parent": 0,
"count": 7
},
{
"id": 53,
"name": "Style",
"parent": 0,
"count": 3
}
]
},
{
"type": "priceslider",
"title": "Price",
"url_key": "price",
"url_key_min_price": "min_price",
"url_key_max_price": "max_price",
"price_url_format": "two",
"data_display": []
},
{
"type": "date",
"title": "Date",
"url_key_date_after": "date_after",
"url_key_date_before": "date_before",
"min_max_date": {
"min_date": "2020-05-24",
"max_date": "2020-06-26"
},
"data_display": []
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter/303"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter"
}
],
"about": [
{
"href": "https://example.com/wp-json/wp/v2/types/pwf_woofilter"
}
],
"wp:attachment": [
{
"href": "https://example.com/wp-json/wp/v2/media?parent=303"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
This API lets you retrieve and view a specific filter post by ID.
HTTP request
https://example.com/wp-json/wp/v2/pwf_woofilter/<id>
List All Filters
JSON response example:
[
{
"id": 303,
"title": "API Filter",
"filter_items": [
{
"type": "checkboxlist",
"title": "Category",
"url_key": "catgory",
"source": "category",
"taxonomy": "product_cat",
"data_display": [
{
"id": 16,
"name": "Accessories",
"parent": 0,
"count": 8
},
{
"id": 17,
"name": "Clothing",
"parent": 0,
"count": 12
}
]
},
{
"type": "textlist",
"title": "Brands",
"url_key": "brand",
"source": "taxonomy",
"taxonomy": "pwb-brand",
"multi_select": "on",
"data_display": [
{
"id": 49,
"name": "cninja",
"parent": 0,
"count": 5
},
{
"id": 51,
"name": "premium",
"parent": 0,
"count": 5
}
]
},
{
"type": "radiolist",
"title": "Season",
"url_key": "season",
"source": "attribute",
"taxonomy": "pa_season",
"data_display": [
{
"id": 0,
"name": "Show all",
"parent": 0,
"count": 0
},
{
"id": 29,
"name": "Summer",
"parent": 0,
"count": 7
},
{
"id": 30,
"name": "Winter",
"parent": 0,
"count": 7
}
]
},
{
"type": "colorlist",
"title": "Colors",
"url_key": "color",
"source": "attribute",
"taxonomy": "pa_color",
"multi_select": "on",
"data_display": [
{
"id": 27,
"name": "Blue",
"parent": 0,
"count": 8,
"type": "color",
"color": "#1e73be",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 60,
"name": "Brown",
"parent": 0,
"count": 2,
"type": "color",
"color": "#8b4513",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 28,
"name": "Green",
"parent": 0,
"count": 6,
"type": "color",
"color": "#008000",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 57,
"name": "orange",
"parent": 0,
"count": 8,
"type": "color",
"color": "#ffa500",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 58,
"name": "pink",
"parent": 0,
"count": 8,
"type": "color",
"color": "#ff7a90",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 56,
"name": "purple",
"parent": 0,
"count": 6,
"type": "color",
"color": "#800080",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 26,
"name": "Red",
"parent": 0,
"count": 3,
"type": "color",
"color": "#dd0808",
"image": "",
"bordercolor": "",
"marker": "light"
},
{
"id": 59,
"name": "Turquoise",
"parent": 0,
"count": 2,
"type": "color",
"color": "#48d1cc",
"image": "",
"bordercolor": "",
"marker": "light"
}
]
},
{
"type": "boxlist",
"title": "Size",
"url_key": "Size",
"source": "attribute",
"taxonomy": "pa_size",
"multi_select": "on",
"data_display": [
{
"id": 35,
"name": "10",
"parent": 0,
"count": 4
},
{
"id": 33,
"name": "11",
"parent": 0,
"count": 1
}
]
},
{
"type": "dropdownlist",
"title": "Tags",
"url_key": "tag",
"source": "tag",
"taxonomy": "product_tag",
"data_display": [
{
"id": 52,
"name": "Fashion",
"parent": 0,
"count": 7
},
{
"id": 53,
"name": "Style",
"parent": 0,
"count": 3
}
]
},
{
"type": "priceslider",
"title": "Price",
"url_key": "price",
"url_key_min_price": "min_price",
"url_key_max_price": "max_price",
"price_url_format": "two",
"data_display": []
},
{
"type": "date",
"title": "Date",
"url_key_date_after": "date_after",
"url_key_date_before": "date_before",
"min_max_date": {
"min_date": "2020-05-24",
"max_date": "2020-06-26"
},
"data_display": []
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter/303"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter"
}
],
"about": [
{
"href": "https://example.com/wp-json/wp/v2/types/pwf_woofilter"
}
],
"wp:attachment": [
{
"href": "https://example.com/wp-json/wp/v2/media?parent=303"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
{
"id": 290,
"title": "WooCommerce Filter",
"filter_items": [
{
"type": "checkboxlist",
"title": "Category",
"url_key": "product-catgory",
"source": "category",
"taxonomy": "product_cat",
"data_display": [
{
"id": 16,
"name": "Accessories",
"parent": 0,
"count": 8
},
{
"id": 18,
"name": "Hoodies",
"parent": 17,
"count": 6
},
{
"id": 23,
"name": "Men",
"parent": 0,
"count": 33
},
{
"id": 25,
"name": "Women",
"parent": 0,
"count": 33
}
]
},
{
"type": "radiolist",
"title": "Season",
"url_key": "season",
"source": "attribute",
"taxonomy": "pa_season",
"data_display": [
{
"id": 0,
"name": "Show all",
"parent": 0,
"count": 0
},
{
"id": 31,
"name": "Autumn-spring",
"parent": 0,
"count": 7
},
{
"id": 29,
"name": "Summer",
"parent": 0,
"count": 7
},
{
"id": 30,
"name": "Winter",
"parent": 0,
"count": 7
}
]
},
{
"type": "textlist",
"title": "Brands",
"url_key": "brand",
"source": "taxonomy",
"taxonomy": "pwb-brand",
"multi_select": "on",
"data_display": [
{
"id": 49,
"name": "cninja",
"parent": 0,
"count": 5
},
{
"id": 50,
"name": "dreamx",
"parent": 0,
"count": 3
},
{
"id": 51,
"name": "premium",
"parent": 0,
"count": 5
}
]
},
{
"type": "dropdownlist",
"title": "dropdown",
"url_key": "dropdownis",
"source": "attribute",
"taxonomy": "pa_color",
"data_display": [
{
"id": 0,
"name": "Show all",
"parent": 0,
"count": 0
},
{
"id": 27,
"name": "Blue",
"parent": 0,
"count": 8
},
{
"id": 59,
"name": "Turquoise",
"parent": 0,
"count": 2
}
]
},
{
"type": "priceslider",
"title": "Price",
"url_key": "price",
"url_key_min_price": "min-price",
"url_key_max_price": "max-price",
"price_url_format": "two",
"data_display": []
},
{
"type": "date",
"title": "Date",
"url_key_date_after": "date-after",
"url_key_date_before": "date-before",
"min_max_date": {
"min_date": "2020-05-24",
"max_date": "2020-06-26"
},
"data_display": []
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter/290"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wp/v2/pwf_woofilter"
}
],
"about": [
{
"href": "https://example.com/wp-json/wp/v2/types/pwf_woofilter"
}
],
"wp:attachment": [
{
"href": "https://example.com/wp-json/wp/v2/media?parent=290"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
]
This API helps you to view all the filters post.
HTTP request
https://example.com/wp-json/wp/v2/pwf_woofilter
Filter Products
JSON response example:
{
"products": [ {},{}, ... ],
"filter_items": [ {}, {}, ... ]
}
This API helps you to retrieve products and filter items.
HTTP request
wp-json/wc-pwfwoofilter/v1/filterproducts/?filter_id=<id>&<url_key>=<id>
Available parameters
Parameter | Type | Description |
---|---|---|
filter_id | integer | The filter post id. |
url_key | String | Unique identifier for the filter item. |
Schema
Parameter | Type | Description |
---|---|---|
products | array | Display a list of products the same response as Woocommerce API List all products. |
filter_items | array | display a list of filter items. |
Example
JSON response example:
{
"products": [
{
"id": 136,
"name": "Parka Jacket",
"slug": "parka-jacket",
"permalink": "https://example.com/product/parka-jacket/",
"date_created": "2020-06-26T03:02:33",
"date_created_gmt": "2020-06-26T03:02:33",
"date_modified": "2020-07-17T12:32:07",
"date_modified_gmt": "2020-07-17T12:32:07",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "<p>Pellentesque habitant morbi tristique senectus.<p>\n",
"short_description": "<p>Pellentesque habitant morbi tristique senectus.<p>\n",
"sku": "HOODIE-PATIENT-NINJA-1",
"price": "35",
"regular_price": "35",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "$35.00",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
11,
28,
74,
30,
83
],
"upsell_ids": [],
"cross_sell_ids": [
57
],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 17,
"name": "Clothing",
"slug": "clothing"
},
{
"id": 18,
"name": "Hoodies",
"slug": "hoodies"
},
{
"id": 23,
"name": "Men",
"slug": "men"
},
{
"id": 25,
"name": "Women",
"slug": "women"
}
],
"tags": [
{
"id": 53,
"name": "Style",
"slug": "style"
}
],
"images": [
{
"id": 176,
"date_created": "2020-06-26T15:16:43",
"date_created_gmt": "2020-06-26T15:16:43",
"date_modified": "2020-06-26T15:16:43",
"date_modified_gmt": "2020-06-26T15:16:43",
"src": "https://example.com/wp-content/uploads/2020/06/Women-Navy-Blue-Solid-Parka-Jacket.jpg",
"name": "Women-Navy-Blue-Solid-Parka-Jacket",
"alt": ""
},
{
"id": 177,
"date_created": "2020-06-26T15:16:52",
"date_created_gmt": "2020-06-26T15:16:52",
"date_modified": "2020-06-26T15:16:52",
"date_modified_gmt": "2020-06-26T15:16:52",
"src": "https://example.com/wp-content/uploads/2020/06/Women-Navy-Blue-Solid-Parka-Jacket-4.jpg",
"name": "Women-Navy-Blue-Solid-Parka-Jacket-4",
"alt": ""
}
],
"attributes": [
{
"id": 3,
"name": "Size",
"position": 0,
"visible": true,
"variation": false,
"options": [
"8",
"8.5",
"9.5",
"9",
"10"
]
},
{
"id": 2,
"name": "Season",
"position": 1,
"visible": true,
"variation": false,
"options": [
"Autumn-spring",
"Summer",
"Winter"
]
},
{
"id": 1,
"name": "Color",
"position": 2,
"visible": true,
"variation": false,
"options": [
"orange",
"Blue",
"pink",
"purple"
]
}
],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 1138,
"key": "pro_product_status",
"value": "pwf_instock"
},
{
"id": 1139,
"key": "_pro_product_status",
"value": "field_5ef37842e57d8"
}
],
"brands": [
{
"id": 49,
"name": "cninja",
"slug": "cninja"
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/136"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products"
}
]
}
},
{
"id": 116,
"name": "Raincoat",
"slug": "raincoat",
"permalink": "https://example.com/product/raincoat/",
"date_created": "2020-06-24T13:59:55",
"date_created_gmt": "2020-06-24T13:59:55",
"date_modified": "2020-07-17T12:32:21",
"date_modified_gmt": "2020-07-17T12:32:21",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "<p>Pellentesque habitant morbi tristique senectus.<p>\n",
"short_description": "<p>Pellentesque habitant morbi tristique senectus.<p>\n",
"sku": "HOODIE-PATIENT-NINJA",
"price": "35",
"regular_price": "35",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"price_html": "$35.00",
"on_sale": false,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0.00",
"rating_count": 0,
"related_ids": [
57,
80,
19,
60,
101
],
"upsell_ids": [],
"cross_sell_ids": [
57
],
"parent_id": 0,
"purchase_note": "",
"categories": [
{
"id": 17,
"name": "Clothing",
"slug": "clothing"
},
{
"id": 18,
"name": "Hoodies",
"slug": "hoodies"
},
{
"id": 23,
"name": "Men",
"slug": "men"
},
{
"id": 25,
"name": "Women",
"slug": "women"
}
],
"tags": [
{
"id": 53,
"name": "Style",
"slug": "style"
}
],
"images": [
{
"id": 165,
"date_created": "2020-06-26T14:50:56",
"date_created_gmt": "2020-06-26T14:50:56",
"date_modified": "2020-06-26T14:50:56",
"date_modified_gmt": "2020-06-26T14:50:56",
"src": "https://example.com/wp-content/uploads/2020/06/2-3-1-1-1.jpg",
"name": "2-3-1-1-1",
"alt": ""
},
{
"id": 166,
"date_created": "2020-06-26T14:51:06",
"date_created_gmt": "2020-06-26T14:51:06",
"date_modified": "2020-06-26T14:51:06",
"date_modified_gmt": "2020-06-26T14:51:06",
"src": "https://example.com/wp-content/uploads/2020/06/2-4-1-1.jpg",
"name": "2-4-1-1",
"alt": ""
}
],
"attributes": [
{
"id": 3,
"name": "Size",
"position": 0,
"visible": true,
"variation": false,
"options": [
"8",
"8.5",
"9.5",
"9",
"10"
]
},
{
"id": 2,
"name": "Season",
"position": 1,
"visible": true,
"variation": false,
"options": [
"Autumn-spring",
"Summer",
"Winter"
]
},
{
"id": 1,
"name": "Color",
"position": 2,
"visible": true,
"variation": false,
"options": [
"Red",
"orange",
"Blue",
"Green",
"pink",
"purple"
]
}
],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"meta_data": [
{
"id": 1219,
"key": "pro_product_status",
"value": "pwf_instock"
},
{
"id": 1220,
"key": "_pro_product_status",
"value": "field_5ef37842e57d8"
}
],
"brands": [
{
"id": 49,
"name": "cninja",
"slug": "cninja"
}
],
"_links": {
"self": [
{
"href": "https://example.com/wp-json/wc/v3/products/116"
}
],
"collection": [
{
"href": "https://example.com/wp-json/wc/v3/products"
}
]
}
}
],
"filter_items": [
{
"type": "checkboxlist",
"title": "Category",
"url_key": "product-catgory",
"source": "category",
"taxonomy": "product_cat",
"data_display": [
{
"id": 16,
"name": "Accessories",
"parent": 0,
"count": 7
},
{
"id": 23,
"name": "Men",
"parent": 0,
"count": 5
},
{
"id": 25,
"name": "Women",
"parent": 0,
"count": 5
},
{
"id": 17,
"name": "Clothing",
"parent": 0,
"count": "5"
},
{
"id": 24,
"name": "shoes",
"parent": 0,
"count": 4
},
{
"id": 18,
"name": "Hoodies",
"parent": 17,
"count": 3
},
{
"id": 19,
"name": "Tshirts",
"parent": 17,
"count": 2
},
{
"id": 15,
"name": "Uncategorized",
"parent": 0,
"count": 0
}
],
"data_select": [
17
]
},
{
"type": "textlist",
"title": "Brands",
"url_key": "brand",
"source": "taxonomy",
"taxonomy": "pwb-brand",
"multi_select": "off",
"data_display": [
{
"id": 49,
"name": "cninja",
"parent": 0,
"count": 3
},
{
"id": 50,
"name": "dreamx",
"parent": 0,
"count": 3
},
{
"id": 51,
"name": "premium",
"parent": 0,
"count": 1
}
],
"data_select": []
},
{
"type": "priceslider",
"title": "Price",
"url_key": "price",
"url_key_min_price": "min-price",
"url_key_max_price": "max-price",
"price_url_format": "two",
"data_display": [],
"data_select": [
"35",
"80"
]
},
{
"type": "date",
"title": "Date",
"url_key_date_after": "date-after",
"url_key_date_before": "date-before",
"min_max_date": {
"min_date": "2020-05-24",
"max_date": "2020-06-26"
},
"data_display": [],
"data_select": [
"2020-05-01",
"2020-07-01"
]
}
]
}
This example filter products by category, price, date
HTTP request
wp-json/wc-pwfwoofilter/v1/filterproducts/?filter_id=294&product-category=17&min-price=35&max-price=80&date-after=2020-05-01&date-before=2020-07-01
Steps
You can get filter_id and url_key for each filter items from here.
- filter_id: it is 294.
- url_key
- category: url_key is product-category and values can be one or more in data_display options id
- Price: url_key form min price is min-price, and max price is max-price, values are 35 and 80.
- Date: url_key form date after is date-after, and for a date before is date-before, values are 2020-05-01 and 2020-07-01.