Skip to main content

fdk-compare-action

Deprecation Notice

Vue-based themes will soon be deprecated. Please switch to React-based themes, as all future updates and support will focus exclusively on React.

Compare Action Component

Tag

fdk-compare-action

Description

This action component is used to add a particular product to compare on the compare page, product is added into the compare using its slug.

Props

KeyTypeDescription
addComparefunctionThis function is used to add the product into compare.
addCompare(slug)functionHere, (slug) is the product's slug that is needed to be added in compare.
removeComparefunctionThis function is used to remove products from the compare and update the router while removing the product from it.
removeCompare(slug)functionHere, (slug) is the product's slug that is needed to be removed from compare.
addMultipleComparefunctionThis function is used to add multiple products into the compare at the same time.
addMultipleCompare([slug1, slug2, slug3, ...])functionHere array of multiple slug is passed as a parameter.
navigateToComparefunctionThis function is used to update the router, while pushing the slugs of available products in compare.
resetComparefunctionThis function resets the compare by removing all the products from compare and updating the router while removing all the product slugs from it.

Example

<fdk-compare-action>
<template slot-scope="compare">
<div
@click="compare.addCompare(product.slug)"
>
<div className="compare-icon">
<img src="./../../../assets/images/compare-icon.png" alt />
</div>
<p>Add to Compare</p>
</div>
</template>
</fdk-compare-action>

Was this section helpful?