Search…
Favorites
Details of the VendorFuel API Favorites service.

Properties

items

Array of products that have been flagged as favorite by the user. Defaults to being an empty object unless the user has logged in and a Favorites method has been invoked.
1
[
2
{product_id: 1, description: 'Product 1', ...},
3
{product_id: 2, description: 'Product 2', ...},
4
]
Copied!

Methods

add(productId)

Adds a product to the user's favorites.
1
const productId = 1;
2
3
Favorites.add(productId);
Copied!
Param
Type
Details
productId
number
ID of product to add to user's favorites.

fillDetails()

Gets an array of favorite products for the current logged-in user.
1
Favorites.fillDetails()
2
.then(resolve => {
3
let favorites = resolve.data.favorites;
4
});
Copied!
Param
Type
Details
productId
number
ID of product to add to user's favorites.

remove(productId)

Removes a product from the user's favorites.
1
const productId = 1;
2
3
Favorites.remove(productId);
Copied!
Param
Type
Details
productId
number
ID of product to remove from the user's favorites.
Last modified 9mo ago