Hide/disable order now and add to cart?

Andrew_TND
Mega Sage
Mega Sage

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 @Andrew_TND 

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-serv...

https://www.servicenow.com/community/developer-forum/hide-disable-quot-add-to-cart-quot-on-portal-ba...

 

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

Regards,

Ravi Chandra.

View solution in original post

3 REPLIES 3

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @Andrew_TND 

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-serv...

https://www.servicenow.com/community/developer-forum/hide-disable-quot-add-to-cart-quot-on-portal-ba...

 

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

Regards,

Ravi Chandra.

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

Community Alums
Not applicable

Hi @Andrew_TND ,

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';

}