Magento 2 module that exposes the customer wishlist through REST APIs. It lets you read the wishlist, add/remove items, move items to cart or back, empty it, and share it.
- Magento 2.4.x with the core module [Magento_Wishlist] enabled
- PHP compatible with your Magento 2.4 installation
- Composer
- Web API authentication set up (customer token or admin token)
.
├── Api/
│ ├── Data/
│ └── WishlistRepositoryInterface.php
├── Model/
│ ├── Data/
│ ├── ResourceModel/
│ └── WishlistRepository.php
├── Plugin/
├── Service/
├── Test/
│ └── Unit/
├── etc/
├── CHANGELOG.md
├── composer.json
├── registration.php
└── README.md
- Api: public PHP interfaces used by webapi routes (service contracts).
- Model: implementations, resource helpers, and response factory.
- Plugin: plugin to restrict/adjust access where needed.
- Service: domain services (e.g., share logic).
- etc: Magento configuration (module.xml, webapi.xml, acl.xml, di.xml).
- Test/Unit: PHPUnit tests.
- Root files: composer.json, registration.php, CHANGELOG.md.
- Install via Composer:
- composer require lucafuser/magento-wishlist-restapi
- Enable and register the module:
- bin/magento module:enable LFuser_WishlistRestApi
- bin/magento setup:upgrade
- bin/magento cache:flush
- Ensure the Magento Wishlist core module is enabled.
- Grant API permissions if using admin tokens (ACL: LFuser_WishlistRestApi::api).
The module adds REST endpoints under /V1. You can call them with a customer token (preferred) or an admin token. When using a customer token, the routes without :customerId will operate on the authenticated customer. The routes with :customerId require proper privileges and are mapped in etc/webapi.xml.
Common endpoints (see full list in webapi.xml):
- GET /V1/wishlist — get my wishlist
- GET /V1/wishlist/item/:sku — get my wishlist item by product SKU
- GET /V1/wishlist/item/:productId — get my wishlist item by product ID
- POST /V1/wishlist/add — add item to my wishlist
- PUT /V1/wishlist/removeItem — remove item from my wishlist
- PUT /V1/wishlist/empty — empty my wishlist
- POST /V1/wishlist/toCart — move a wishlist item to cart
- POST /V1/wishlist/allToCart — move all wishlist items to cart
- POST /V1/wishlist/toWishlist — move an item from cart to wishlist
- POST /V1/wishlist/allToWishlist — move all cart items to wishlist
- POST /V1/wishlist/share — share my wishlist via email
Customer-scoped variations also exist with an explicit :customerId path segment, e.g. GET /V1/wishlist/:customerId. Those require the ACL resource LFuser_WishlistRestApi::api.
Example: get my wishlist with a customer token
curl -X GET \
"https://mystore.test/rest/V1/wishlist" \
-H "Authorization: Bearer <customer_token>" \
-H "Content-Type: application/json"
Example: add an item by SKU to my wishlist
curl -X POST \
"https://mystore.test/rest/V1/wishlist/add" \
-H "Authorization: Bearer <customer_token>" \
-H "Content-Type: application/json" \
-d '{
"sku": "24-MB01",
"qty": 1
}'
Note: Request/response shapes follow the service contracts in Api/. Check etc/webapi.xml for the exact method mapping.
- Open an issue describing the change or problem.
- Fork the repo and create a feature branch.
- Add or update unit tests under Test/Unit.
- Run tests locally (phpunit) and ensure coding standards.
- Submit a pull request with a clear description of the changes.
- Email: luca.a.fuser@gmail.com
- LinkedIn: https://www.linkedin.com/in/luca-alessio-fuser/