Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dlerm/shopify-wishlist-app
💚 A Shopify Wishlist App back-end that can be used in addition to the Shopify Wishlist theme files.
https://github.com/dlerm/shopify-wishlist-app
api app backend express javascript metafields node shopify wishlist
Last synced: 7 days ago
JSON representation
💚 A Shopify Wishlist App back-end that can be used in addition to the Shopify Wishlist theme files.
- Host: GitHub
- URL: https://github.com/dlerm/shopify-wishlist-app
- Owner: dlerm
- Created: 2021-11-04T06:20:00.000Z (about 3 years ago)
- Default Branch: develop
- Last Pushed: 2021-11-04T06:55:16.000Z (about 3 years ago)
- Last Synced: 2024-04-15T00:38:35.893Z (9 months ago)
- Topics: api, app, backend, express, javascript, metafields, node, shopify, wishlist
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shopify Wishlist App
A Shopify Wishlist App that can be used seamlessly with the [Shopify Wishlist](https://github.com/dlerm/shopify-wishlist) theme files.
### Overview
This is a back-end solution meant for usage as a Shopify private app. The app saves customer wishlists into metafields to avoid the need for an external data store.### How It Works
The app creates & updates a customer metafield that stores a string list of product handles (comma separated).|Metafield | Value |
|----------|-------|
|customer.metafields.shopify_wishlist_app.wishlist|"product-handle-1,product-handle2,..."The front-end can make requests to the app's endpoints to fetch, create, update or delete a wishlist.
### How To Use
1. Host this app on a server of your choice
2. Setup your server's environment variables
3. Query the app endpoints (via Javascript) from your Shopify theme to display or manipulate a customer's wishlist##### ENV Setup
```
# Origins/URLs that are allowed to make App/API requests
# Inlcude the http/https protocols
# Comma separated for multiple origins
ALLOWED_ORIGINS=https://customer-wishlist.myshopify.com# The "myshopify" domain without the "myshopify.com" ending
SHOPIFY_DOMAIN=customer-wishlist# Shopify private app key
API_KEY=xxxxxxxxxxxxxxxxxxx# Shopify private app password/secret
API_PASSWORD=xxxxxxxxxxxxxxxxxxx
```### Request Endpoints
All endpoints require a single `:id` parameter in the URL which should represent a unique Shopify customer ID. Each request type may have extra data needed to fulfill the request, see below.
##### GET `/wishlist/:id`
---
**Query Parameters**
|Name|Required|Description|
|----:|:----:|----|
|format|optional|The format of the wishlist items to be returned.
Supported value: `product`
By default the wishlist will be returned as an `Array` representing the product handles. Supplying the value `product` will return the wishlist as an `Array` representing the full [Shopify product JSON](https://shopify.dev/api/admin-rest/2021-10/resources/product#[get]/admin/api/2021-10/products/{product_id}.json). |**Response (Default)**
```
{
"id": ,
"wishlist": [
"",
"",
...
],
"metafield": {
"id": ,
"namespace": "shopify_wishlist_app",
"key": "wishlist",
"value": ",,...",
"value_type": "string",
"description": null,
"owner_id": ,
"created_at": ,
"updated_at":
"owner_resource": "customer",
"admin_graphql_api_id": "gid://shopify/Metafield/"
},
"status": {
"message": "OK",
"code": 200
}
}
```
**Response (Format: `product`)**[Only displaying the `wishlist` response key for brevity]
```
{
"wishlist": [
{ },
{ },
...
],
...
}
```##### POST `/wishlist/:id`
---
**Body Parameters**
|Name|Required|Description|
|----:|:----:|----|
|handle|required|The Shopify product handle that should be added/removed from the wishlist.
This endpoint acts as a toggle. If the requested handle does not currently exist in the wishlist, add it, otherwise remove it.|**Response**
```
{
"metafield": {
"namespace": "shopify_wishlist_app",
"key": "wishlist",
"value_type": "string",
"value": ",,..."
},
"status": {
"message": "OK",
"code": 200
}
}
```
##### DELETE `/wishlist/:id`
---
**Parameters** - None**Response**
```
{
"metafield": {},
"status": {
"message": "OK",
"code": 200
}
}
```