- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:22 AM
Hi,
I need help to hide/disable "Add to cart" for a specific catalog item. We have a Yes/No variable and if variable is answered as No only then hide "Add to Cart" button.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 07:48 AM
Hi,
just use it in onchange
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(g_form.getValue(have_you) == 'No')
{
if(window == null){
// for portal
var z = this.document.getElementsByClassName("btn btn-default sc-btn form-control ng-scope");
z[0].style.display = 'none';
}
else{
// for native
gel('oi_add_to_cart_button').style.display = 'none';
}
}
else{
if(window == null){
// for portal
var z = this.document.getElementsByClassName("btn btn-default sc-btn form-control ng-scope");
z[0].style.display = '';
}
else{
// for native
gel('oi_add_to_cart_button').style.display = '';
}
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 06:45 AM
Hi,
For that you would require DOM manipulation but that is not recommended.
If you still want to go ahead refer these link(s) for sample script
To Hide "Add to Cart " & "Order Now " Button using client script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 07:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 07:34 AM
Hi,
DOM won't work in portal
where are you running this?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2020 07:38 AM
I am trying to hide the "Add to cart" on Service portal.
Thanks