2 min read
Wishlist extensions
The Wishlist screen gives your customers a space in your app to save products they like, without adding them to their cart.
When your customers interact with their Wishlist, you can use an extension to enrich or replace the data displayed to your customers.
Extension Points
There are four extension points you can use in the Wishlist, each one corresponds to key behaviours of the wishlist screen:
Get Wishlist - Gets your customer's wishlist to display in the app, or creates a new one if they do not yet have one. Whenever this happens, you can use this extension point to add, change or enrich the data.
Add an item to Wishlist - When your customer adds an item to their wishlist, you can use this extension point to update your system.
Delete an item from Wishlist - When your customer deletes an item from their wishlist, you can use this extension point to update your system.
Delete entire Wishlist - When your customer deletes their wishlist, you can use this extension point to update your system.
Get Wishlist
Poq.Context.Checkout.Wishlist.Get.Extension
Gets a customer's wishlist from your system or allows your system to modify a customer's wishlist in real time.
FETCH
Fetches the data for the customer's wishlist from your external system. The data received from your system is used to populate the Wishlist seen by the customer.
Use this extension when the wishlist entirely depends on data in your system, including when a customer uses the app to add something to their wishlist.
Request
This request is sent by the Poq platform to your external system:
GET
{yourApi}
Accept: application/jsonAuthorization: {Authorization Header Value}
Example extension URL: api.myshop.com/wishlist
Response
The response below is a sample of what should be returned by your external system. Those fields marked Required must be included in your response.
200 OK
{ "items": [ // Required { "productId": "", // Required "listingId": "" // Required "variantId": "" "customData": {} } ], "customData": {}}
When the wishlist is empty, the response must have the status code 200 OK with an empty wishlist. It may have custom data:
200 OK
{ "items": [], "customData": {}}
REPLACE
Sends the data for your customer's from the Poq database, and expects new wishlist data. The existing wishlist on the Poq database is then replaced by the new wishlist and the new wishlist is sent to the app.
Use this extension type when wishlist functionality depends on the Poq database enriched with data on your system.
Request
This request is sent when the customer already has a wishlist:
POST
{yourApi}
Accept: application/jsonAuthorization: {Authorization Header Value}
{ "items": [ { "productId": "", // Required "listingId": "", // Required "variantId": "", "customData": {} } ], "customData": {}}
This request is sent when the customer does not have a wishlist:
POST
{yourApi}
Accept: application/jsonAuthorization: {Authorization Header Value}
Example extension URL: api.myshop.com/wishlist
Response
200 OK
{ "items": [ { "productId": "", // Required "listingId": "", // Required "variantId": "", "customData": {} } ], "customData": {}}
When the wishlist is empty, the response must have the status code 200 OK with an empty wishlist. It may have custom data:
200 OK
{ "items": [], "customData": {}}
EXTEND
Uses data from your system to extend the wishlist stored on the Poq's database, before sending the wishlist to the app.
Use this extension type when wishlist functionality depends on data in the Poq database. Data from your system is used to enrich the results based only on the ID of the customer.
Request
The Poq app sends this request to your system:
GET
{yourApi}
Accept: application/jsonAuthorization: {Authorization Header Value}
Response
200 OK
{ "items": [ { "productId": "", "variantId": "", "customData": {} } ], "customData": {}}
Example extension URL: api.myshop.com/wishlist
If the response contains the items
field, the wishlist items on the Poq's end are discarded and the items from the extension are passed to the app.
Add Item To Wishlist
Poq.Context.Checkout.Wishlist.AddItem.Extension
PUSH
When a user adds an item to the wishlist, pushes this action to the extension.
Request
POST
{yourApi}
Accept: application/jsonAuthorization: {Authorization Header Value}
{ "productId": "", "variantId": "", "customData": {}}
Example extension URL: api.myshop.com/wishlist/items
Delete An Item From The Wishlist
Poq.Context.Checkout.Wishlist.DeleteItem.Extension
PUSH
When a user deletes an item from the wishlist, pushes this action to the extension.
Request
DELETE
{yourApi}/{variantid}
Authorization: {Authorization Header Value}
Example extension URL: api.myshop.com/wishlist/items/listingId
Delete All Items From The Wishlist
Poq.Context.Checkout.Wishlist.Delete.Extension
PUSH
When a user deletes all items from their wishlist, pushes this action to the extension.
Request
DELETE
{yourApi}
Authorization: {Authorization Header Value}
Example extension URL: api.myshop.com/wishlist