Skip to content

REST API Reference

/wp-json/webtriad-awl/v1/

Get wishlist with items.

GET /wishlist

Query Parameters:

ParameterTypeDefaultDescription
pageint1Page number
per_pageint10Items per page (max 20)

Response:

{
"id": 1,
"user_id": 5,
"status": "active",
"created_at": "2024-01-01 12:00:00",
"updated_at": "2024-01-01 12:00:00",
"items": [
{
"id": 1,
"wishlist_id": 1,
"product_id": 123,
"variation_id": 0,
"quantity": 1,
"attributes": {},
"added_at": "2024-01-01 12:00:00"
}
],
"pagination": {
"total": 15,
"page": 1,
"per_page": 10,
"total_pages": 2
}
}

Add product to wishlist.

POST /wishlist/items

Body:

{
"product_id": 123,
"variation_id": 0,
"quantity": 1,
"attributes": {}
}

Response:

{
"id": 1,
"wishlist_id": 1,
"product_id": 123,
"variation_id": 0,
"quantity": 1,
"attributes": {},
"added_at": "2024-01-01 12:00:00"
}

Remove product from wishlist.

DELETE /wishlist/items

Body:

{
"product_id": 123,
"variation_id": 0
}

Response:

{
"success": true
}

Add all wishlist items to cart.

POST /wishlist/add-all-to-cart

Response:

{
"success": true,
"added": 5,
"failed": 2,
"message": "5 item(s) added to cart. 2 item(s) could not be added."
}

Get dashboard statistics (admin only).

GET /dashboard/stats

Response:

{
"total_wishlists": 150,
"total_items": 450,
"guest_wishlists": 50,
"user_wishlists": 100
}

Get top wishlisted products (admin only).

GET /dashboard/top-products

Query Parameters:

ParameterTypeDefaultDescription
limitint10Number of products

Response:

[
{
"product_id": 123,
"product_name": "T-Shirt",
"count": 45
}
]

Get plugin settings (admin only).

GET /settings

Response:

{
"wishlist_page": {
"wishlist_page_id": 5,
"require_login": false,
"redirect_guests": false
},
"product_page": {
"enabled": true,
"position": "below_add_to_cart"
}
}

Update plugin settings (admin only).

POST /settings

Body:

{
"wishlist_page": {
"wishlist_page_id": 5
},
"product_page": {
"enabled": true,
"position": "below_add_to_cart"
}
}

Response:

{
"success": true,
"settings": { }
}

All endpoints return standard WordPress REST API errors:

{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): product_id",
"data": {
"status": 400
}
}
CodeStatusDescription
rest_invalid_param400Invalid parameter
rest_forbidden403Permission denied
wishlist_not_found404Wishlist not found
item_not_found404Item not found
wishlist_error500General wishlist error