if cart is empty, disable cart icon in serviceportal

Devi D
Tera Expert

Hi Everyone ,

 

if we add any items then cart icon should be displayed , if not cart should be hidden in service portal.

 

can anyone please help me on this requirement .

 

 

Thank you .

7 REPLIES 7

Hi Juhi,

I have tried updating this , but it is not working . so, do we need pass the cart item count from the server side  .

 

I have tried that also , it is not working

Hello @Devi D 

Please check if the cart count updates when adding the items in cart.

Also try adding the only condition cartItemCount > 0 as we don't want to utilize the enable cart option.

Please share the screenshot of html code for your widget, so that I can assist you further.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

Bhavya11
Kilo Patron

Hi @Devi D ,

 

The Header Menu widget that contains the shopping cart code , so clone the OOTB Header Menu widget then change the below code in html of widget 

<!-- Shopping cart stuff -->
	
<li ng-if="::options.enable_cart && data.isLoggedIn" ng-show="cartItemCount > 0 && !accessibilityEnabled" class="dropdown hidden-xs header-menu-item" role="presentation">

   <a href
      data-toggle="dropdown"
      id="cart-dropdown"
      uib-tooltip-template="'item-added-tooltip.html'"
      tooltip-placement="bottom"
      tooltip-trigger="'none'"
      tooltip-is-open="$parent.itemAddedTooltipOpen"
      title="${Your shopping cart currently has} {{cartItemCount}} ${items}"
      aria-label="${Shopping cart}"
      role="menuitem">
       <i class="fa fa-shopping-cart" aria-hidden="true"></i>
     <span ng-bind-html="'${Cart}'" aria-hidden="true"></span>
     <span ng-if="cartItemCount > 0" aria-hidden="true" class="label label-as-badge label-primary sp-navbar-badge-count">{{cartItemCount}}</span>
       </a>
   <div class="dropdown-menu cart-dropdown">
     <sp-widget widget="data.cartWidget"></sp-widget>
   </div>
 </li>

 

after that you need to update the widget and applied this widget in widget instance.

 

 

Thanks,

BK