Procyon Like Bag
API-only WooCommerce simple favorites plugin with guest token sessions, persistent user storage, and automatic guest-to-user merge.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/bartek5186/procyon-like-bag/archive/refs/heads/main.zip
"Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinking badges."
- The Treasure of the Sierra Madre
Procyon Like Bag
API-only WooCommerce "favorites bag" plugin.
It stores favorite products:
- for guests using a temporary
token(cookie/header/query param), - for logged-in users using a stable DB record per account.
REST API
Namespace: procyon-like-bag/v1
Session
GET /wp-json/procyon-like-bag/v1/session- Creates guest token when needed and returns bag snapshot.
- Params:
include_products(bool, defaultfalse)auto_merge(bool, defaulttrue) for logged-in users with guest token.
List items
GET /wp-json/procyon-like-bag/v1/items- Params:
include_products(bool, defaultfalse)
Add item
POST /wp-json/procyon-like-bag/v1/items- Body:
product_id(int, required)
Remove item
DELETE /wp-json/procyon-like-bag/v1/items/{product_id}
Toggle item
POST /wp-json/procyon-like-bag/v1/toggle- Body:
product_id(int, required)
Clear bag
DELETE /wp-json/procyon-like-bag/v1/items
Count
GET /wp-json/procyon-like-bag/v1/count
Merge guest -> user
POST /wp-json/procyon-like-bag/v1/merge- Requires logged-in user.
- Optional body param:
token.
Token handling for guests
Guest token can be passed in:
- header:
X-Procyon-Like-Bag-Token - request param:
token - cookie:
procyon_like_bag_token
When a guest token exists, API response includes:
- JSON field:
token - response header:
X-Procyon-Like-Bag-Token
Logged-in mode notes
- For stable account-based favorites, requests must carry WordPress auth context.
- Recommended for frontend requests: send credentials and
X-WP-Nonce. - The plugin also supports same-origin logged-in cookie fallback for REST requests.
License
This project is open source and licensed under GNU GPL v2 or later (GPL-2.0-or-later).
See LICENSE.