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.

[
{product_id: 1, description: 'Product 1', ...},
{product_id: 2, description: 'Product 2', ...},
]

Methods

add(productId)

Adds a product to the user's favorites.

const productId = 1;
Favorites.add(productId);

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.

Favorites.fillDetails()
.then(resolve => {
let favorites = resolve.data.favorites;
});

Param

Type

Details

productId

number

ID of product to add to user's favorites.

remove(productId)

Removes a product from the user's favorites.

const productId = 1;
Favorites.remove(productId);

Param

Type

Details

productId

number

ID of product to remove from the user's favorites.