Recent Topics

Hide comparasion button if is on compare page



  • Hi, how can I hide this button if that product is on the comparison list or still delete it?
    Is there a way?

    <template>
        <a
            :title="`${addTooltip}`"
            class="unset compare-icon text-right"
            @click="addProductToCompare">
            <i class="material-icons">compare_arrows</i>
        </a>
    </template>
    addProductToCompare: function () {
                    if (this.customer == "true" || this.customer == true) {
                        this.$http.put(
                            `${this.$root.baseUrl}/comparison`, {
                                productId: this.productId,
                            }
                        ).then(response => {
                            window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message);
                        }).catch(error => {
                            window.showAlert(
                                'alert-danger',
                                this.__('shop.general.alert.error'),
                                this.__('error.something_went_wrong')
                            );
                        });
    


  • Hi @LilD,

    You need to check in the local storage for the guest user and in the database (velocity_customer_compare_products table) for customer users.


Log in to reply