if cart is empty, disable cart icon in serviceportal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 10:45 PM
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 10:56 PM
what's your business requirement for this?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 11:41 PM
Hi Ankur,
As per client requirement , ideally cart icon should not be visible on the header menu on service portal. if items added , then only it should be visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 04:18 AM
you will have to clone the OOB widget and then handle the visibility.
But I won't recommend doing this.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 11:38 PM
Hello @Devi D
- You can directly enable or disable the cart from the menu item.
- However, if you want to add a condition, it is set in the Header Menu widget, which is read-only.
- If you are already using a cloned version of this widget, you can add an additional condition (&& cartItemCount > 0).
The updated condition will be:
::options.enable_cart && data.isLoggedIn && !accessibilityEnabled && cartItemCount > 0
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