Skip to content

Cart API - Move to Wishlist

This API allows users to move selected items from their cart to the wishlist.


Endpoints Overview

Method Endpoint Description
POST /api/v1/cart/move-to-wishlist/ Move selected cart items to the user's wishlist.

Cart API - Move to Wishlist

1. Move Selected Cart Items to Wishlist

Endpoint

  • URL: /api/v1/cart/move-to-wishlist/
  • Method: POST
  • Permission Required: IsAuthenticated

Description

Moves selected items from the user's cart to their wishlist. If the items are already in the wishlist, they will not be added again. The items will be removed from the cart.

Request Body

  • item_ids (Required): A list of cart item IDs to be moved to the wishlist.

Example Request

This is the endpoint

POST /api/v1/cart/move-to-wishlist/


Request Body

This is the request body

{
  "item_ids": [1, 2, 3]
}


Success

{
    "id": 28,
    "product": {
        "id": 34,
        "name": "New Product",
        "price": 222.0,
        "discount_percent": 22.0,
        "description": "xcvxc",
        "images": [
            {
                "id": 19,
                "image": "/media/product/image/gg_pt1x1sS.png"
            },
            {
                "id": 20,
                "image": "/media/product/image/1_ss_gTsD8uy.png"
            }
        ],
        "primary_image": "/media/product/image/gg_pt1x1sS.png"
    },
    "variant": {
        "id": 76,
        "variant_price": 222.0,
        "discounted_price": 173.16,
        "stock_quantity": 32,
        "is_available": true,
        "is_active": true,
        "size": {
            "id": 2,
            "size": "Small",
            "value": "S"
        }
    },
    "quantity": 1,
    "total_price": 222.0,
    "discount_amount": 48.84,
    "final_price": 173.16,
    "is_direct_purchase": false,
    "has_purchased": false,
    "created_at": "12-16-2024 09:05:33",
    "updated_at": "12-16-2024 09:05:33"
}

Error

{
  "error": "No item IDs provided"
}

Error

{
  "error": "No valid cart items found"
}