Skip to content

Toggle Wishlist

Add or remove a product variant from the user's wishlist. If the item is already in the wishlist, it's removed; otherwise, it's added.

Endpoint

POST /v1/products/wishlist/

Authentication

Required (User role)

Request Body

{
  "product_variant_id": 5
}

Parameters

Field Type Required Description
product_variant_id integer Yes Product variant ID to toggle

Response

Success (200 OK)

When Adding to Wishlist

{
  "message": "Added to wishlist successfully"
}

When Removing from Wishlist

{
  "message": "Removed from wishlist successfully"
}

Error Responses

Product Not Found (404)

{
  "error": "Product Not Found"
}

Validation Error (400)

{
  "message": "Validation error message"
}

Example Request

curl -X POST "https://api.luxmart.site/v1/products/wishlist/" \
  -H "Authorization: Token your_access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "product_variant_id": 5
  }'

Notes

  • If the product variant is already in the wishlist, it's removed
  • If the product variant is not in the wishlist, it's added
  • Product variant must exist and not be deleted
  • Each user can only have one wishlist entry per product variant