The item displays a ‘Free Shipping’ tag when it belongs to the commerce category of salon products.
So, I have identified the commerce category for each item, verified that the category is ‘salon products,’ and cross-checked the internal ID of the category. The code is added below
var item = this.model.get('item');
var commercecategory = item.get('commercecategory')
var primaryPath = commercecategory.primarypath;
var categories = commercecategory.categories;
var salon;
if (primaryPath.length > 0) {
_.each(primaryPath, function (path) {
if (path.name == "Salon Products" && path.id == segmentId) {
salon = true;
}
});
}
else if (categories.length > 0) {
_.each(categories, function (path) {
if (path.name == "Salon Products" && path.id == segmentId) {
salon = true;
}
});
}
if (salon === true) {
itemsSalon.push(item)
}
else {
nonSalon.push(item)
}
if (customersegment && customersegment.value) {
var parseSegment = JSON.parse(customersegment.value)
if (configCustomer) {
if (_.findWhere(parseSegment, { id: configCustomer }) && itemsSalon.length>0) {
GlossLab = true;
}
}
else {
if (_.findWhere(parseSegment, { id: "6636" })&& itemsSalon.length>0) {
GlossLab = true;
}
}
}
template
{{#if GlossLab}}
<div class="facets-moq">
<span class="itemIcons list-font">
Free Ship
</span>
<span class="moq-hover-show">
Free Ship
</span>
{{/if}}