The CreatorCon Call for Content is officially open! Get started here.

Service Portal | Cart menu option

Nuno Oliveira
Mega Guru

Hi guys,

 

I have this requirement that when the cart is empty it is hidden in the header menu and if it has some items it needs to be visible. I've already done this with a query to the sc_cart_item table and added a check variable in the html tag of the header widget. However, the requirement is to toggle the option dynamically, that is, when the user clicks on the button add to cart button, the menu option should pop up automatically.

Anyone knows how to achieve this without cloning the sc catalog item widget? 

 

Thanks in advance.

 

NunoOliveira_0-1668185556495.png

 

1 ACCEPTED SOLUTION

Hello,

 

No for that as well we need to update the client controller of the widget itself it would not be possible.

 

Please mark my answer as correct based on Impact.

View solution in original post

8 REPLIES 8

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Do you mean that the option should be visible when some clicks add to cart and other times it should be hidden?

It should be visible only when the cart has items, otherwise it needs to be hidden.

Hello,

 

I see so unfortunately that would not be possible with the OOB setup.

 

The only possible way is to clone and customize sc catalog item widget but I believe that too will be a bit of work. Plus customizing such a important widget is not recommended as ServiceNow my bring in new features in the future.

 

Please mark my answer as correct based on Impact.

Thanks Saurav. Yes, it needs to be cloned, and I don't want that exactly because of that, it's a important widget.

 

Do you know if I can refresh the page from the Header widget? Like when an item is inserted in the cart, it reloads the page. Because I already have this more or less working, but it needs to reload, that is, when the user inserts an item to the cart and reloads the page the cart appear.