Hide/disable order now and add to cart?

Community Alums
Not applicable

Hello,

How would I go about disable/hide the add to cart and order now buttons from my instance on condition?

I have tried the below client script, however must only be applicable for submit. Even when I look for community solutions theres not much out there...

function onSubmit() {
	g_form.getReference("country_request", function(cou){
		if (cou.u_status == "prohibited"){
			return false;
		}
	});
}



AndrewRobinso1_0-1688078085746.png

 

1 ACCEPTED SOLUTION

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @Community Alums 

Greeting!

for this, you have to use DOM Manipulation.

refer the solution provided by Ankur:

https://www.servicenow.com/community/developer-forum/hide-add-to-cart-and-order-now-button-from-service-portal/m-p/1358806

https://www.servicenow.com/community/developer-forum/hide-disable-quot-add-to-cart-quot-on-portal-based-on-yes-no/m-p/1667066/page/2

 

please hit the Thumb Icon and mark as Correct if it helped !!

Regards,

Ravi Chandra.

View solution in original post

4 REPLIES 4

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @Community Alums 

Greeting!

for this, you have to use DOM Manipulation.

refer the solution provided by Ankur:

https://www.servicenow.com/community/developer-forum/hide-add-to-cart-and-order-now-button-from-service-portal/m-p/1358806

https://www.servicenow.com/community/developer-forum/hide-disable-quot-add-to-cart-quot-on-portal-based-on-yes-no/m-p/1667066/page/2

 

please hit the Thumb Icon and mark as Correct if it helped !!

Regards,

Ravi Chandra.

Community Alums
Not applicable

Legend! Thank you. Even managed to get it to work on change. 😁

Community Alums
Not applicable

Hi @Community Alums ,

For a Particular Catalog Item:

Navigate to >Maintain items > select your catalog Item> go to Portal Settings tab

SandeepDutta_0-1688105050555.png

 

select options as per you requirement. then save and check.

 

However, 

To hide entire cart and frames, I used the following catalog client script:

function onLoad() {

  var cart = document.getElementById('order_and_cart_v2');

  cart.style.display='none';

}

 

The portal setting does not work no matter what. ServiceNow is a pain many times.