Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

jonyw4/vendure-favorites-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vendure Favorites Plugin

This is a plugin for the Vendure e-commerce framework designed for allowing customers to save favorite products.

It's two main functions are allowing a customer to toggle a product as a favorite, and return a list of favorites for a customer entity.

Getting Started

After initializing your vendure project, you can add this plugin via yarn or npm install:

yarn add vendure-favorites-plugin

or

npm install vendure-favorites-plugin

and then include it in the vendure-config as below:

import { FavoritesPlugin } from "vendure-favorites-plugin";

export const config: VendureConfig = {
  ...
  plugins: [
    ...,
    FavoritesPlugin
  ]
}

This plugin includes an optional Admin UI Extension.

AdminUiPlugin.init({
  ...
  app: compileUiExtensions({
    ...
    extensions: [
      ...
      FavoritesPlugin.uiExtensions,
      ...
    ]
  }),
  ...
})

API Extensions

This plugin implements the following extensions to the API.

Favorite Entity

type Favorite implements Node {
  id: ID!
  createdAt: DateTime!
  updatedAt: DateTime!
  product: Product
  customer: Customer!
}

Types

type FavoriteList implements PaginatedList {
  items: [Favorite!]!
  totalItems: Int!
}

Customer Query

extend type Customer {
  favorites(options: FavoriteListOptions, productNameFilter: String): FavoriteList!
}

Shop API

extend type Mutation {
  toggleFavorite(productId: ID!): FavoriteList!
}

Admin API

extend type Query {
  favorite(id: ID!): Favorite
}

Admin UI

The Admin UI extension adds a favorites field to the customer detail page, allowing the user to view a list of the customer's favorites.

hidden-favorites

show-favorites

About

Adds customer favorites to Vendure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.5%
  • Other 0.5%