Skip to main content

Favorite Products

Manage customer's favorite/wishlist products.

HTTP Request

List Favorite Products

GET/api/shop/customers/me/favorites

Add Product to Favorites

POST/api/shop/customers/me/favorites

Remove Product from Favorites

DELETE/api/shop/customers/me/favorites/:product_id

Authorization

Authorization

  • Required: Yes
  • Permission: Authenticated Customer
  • Authentication: Token-based (`Authorization: Token <your_api_key>`)

Query Parameters (GET only)

Supports all product filtering parameters including:

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page
offsetintegerNumber of results to skip
searchstringSearch in product `name`
orderingstringField to order results by (`id`, `name`, `created_at`, `updated_at`, `order`, `active`, `brand__id`, `brand__name`, `category__id`, `category__name`, `stock_type`, `stock`, `regular_price`, `sale_price`, `_price`, `_discount`, `_dicsount_percent`, `_in_stock`, `_rating`, `_comment_count`)
brand_idintegerFilter by brand ID
category_idintegerFilter by category ID
category_tree_idintegerFilter by category tree ID (returns all products in the category and subcategories)
regular_price_minnumberMinimum regular price filter
regular_price_maxnumberMaximum regular price filter
sale_price_minnumberMinimum sale price filter
sale_price_maxnumberMaximum sale price filter
price_minnumberMinimum final price filter
price_maxnumberMaximum final price filter
has_discountbooleanFilter products with/without discount
discount_minnumberMinimum discount amount filter
discount_maxnumberMaximum discount amount filter
discount_percent_minnumberMinimum discount percentage filter
discount_percent_maxnumberMaximum discount percentage filter
in_stockbooleanFilter by stock availability
has_imagebooleanFilter products with/without image
has_commentsbooleanFilter products with/without comments
comments_count_minintegerMinimum comments count filter
comments_count_maxintegerMaximum comments count filter
rating_minnumberMinimum rating filter
rating_maxnumberMaximum rating filter
id_minintegerMinimum ID filter
id_maxintegerMaximum ID filter
created_datestringFilter by creation date (e.g., `2023-01-01`)
updated_datestringFilter by last updated date (e.g., `2023-01-01`)
created_fromstringFilter by creation date range start
created_tostringFilter by creation date range end
updated_fromstringFilter by last updated date range start
updated_tostringFilter by last updated date range end

Request Body (POST only)

FieldTypeRequiredDescription
productintegerNoID of the product to add to favorites

Query Parameters (DELETE only)

FieldTypeRequiredDescription
product_idintegerNoID of the product to remove from favorites (passed as a URL parameter)

Example Requests

1import requests
2
3# List favorite products
4response = requests.get('http://www.example.com/api/shop/customers/me/favorites', 
5  params={
6      'ordering': '-created_at',
7      'has_discount': True
8  },
9  headers={'Authorization': 'Token <your_api_key>'}
10)
11print(response.json())
12
13# Add product to favorites
14response = requests.post('http://www.example.com/api/shop/customers/me/favorites', 
15  json={
16      'product': 456
17  },
18  headers={'Authorization': 'Token <your_api_key>'}
19)
20print(response.status_code)  # Should be 200
21
22# Remove product from favorites
23response = requests.delete('http://www.example.com/api/shop/customers/me/favorites/456', 
24  headers={'Authorization': 'Token <your_api_key>'}
25)
26print(response.status_code)  # Should be 204

Status Codes

CodeDescription
200Favorites retrieved/product added successfully
204Product removed from favorites successfully
400Bad request — invalid product ID
401Unauthorized — authentication required
404Product not found in favorites
500Internal server error