The Spree Wishlist extension enables multiple wishlists per user, as well as managing those as public (sharable) and private. It also includes the ability to notify a friend via email of a recommended product.
Add the following to your Gemfile
gem 'spree_wishlist', github: 'spree-contrib/spree_wishlist', branch: 'master'
Run
bundle install
bundle exec rails g spree_wishlist:install
Please read Spree API v1 summary first.
Available endpoints:
-
GET
/api/v1/wishlists
- returns a list of wishlists for signed in user -
GET
/api/v1/wishlists/:id
- returns single wishlists with a list of Products (Variants) -
POST
/api/v1/wishlists
- creates a new wishlistpayload:
wishlist: { "name": "fathers day" }
-
PATCH
/api/v1/wishlists/:id
payload:
wishlist: { "name": "new name" }
-
DELETE
/api/v1/wishlists/:id
-
POST
/api/v1/wished_products
- adds Product (Variant) to a Wishlistpayload:
wished_product: { "variant_id": 2, "wishlist_id": 1 }
-
PATCH
/api/v1/wished_products/:id
payload:
wished_product: { "variant_id": 3, "wishlist_id": 2 }
-
DELETE
/api/v1/wished_products/:id
-
GET
/api/v2/storefront/wishlists
- returns a list of wishlists for signed in user -
GET
/api/v2/storefront/wishlists/:access_hash
- returns single wishlists with a list of Products (Variants)payload:
{ "include": "wished_products.variant" }
-
PATCH
/api/v2/storefront/wishlists/:access_hash
payload:
wishlist: { "name": "Wishlist name", "is_default": true, "is_private": true, }
-
POST
/api/v2/storefront/wishlists
- creates a new wishlistpayload:
wishlist: { "name": "Wishlist name", "is_default": true, "is_private": true, }
-
DELETE
/api/v2/storefront/wishlists/:access_hash
-
POST
/api/v2/storefront/wishlists/:access_hash/wished_products
- adds Product (Variant) to a Wishlistpayload:
wished_product: { "variant_id": 2, "remark": "I want this", "quantity": 3 }
-
PATCH
/api/v2/storefront/wishlists/:access_hash/wished_products/:id
payload:
wished_product: { "variant_id": 2, "remark": "I want this", "quantity": 4 }
-
DELETE
/api/v2/storefront/wishlists/:access_hash/wished_products/:id
Copyright (c) 2009-2020 Spree Commerce Inc. and contributors, released under the New BSD License