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

how to hide the button add to cart only in backend through client script

Fdeveloper
Kilo Guru

Hi,

i should hide the button add to cart only in the backend in the portal the button should be visible , i try it to check 

Hide 'Add to Cart' to true not working and i try it No cart it works the button is hiding but it also hidding from the portal 

i should hide the button through client script any suggestion please to resolve this issue 

19 REPLIES 19

Hi,

This works for me:

document.getElementById('oi_add_to_cart_button').style.visibility = 'hidden';

Ensure Isolate Script is false:

find_real_file.png

Before script:

find_real_file.png

After script:

find_real_file.png

Please mark reply as Helpful/Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi @Allen Andreas ,

it works only if i use catalog client script , i cannot use catalog client script because i should hide button for 20 catalog item , when i use this in client script don't work 

document.getElementById('oi_add_to_cart_button').style.visibility = 'hidden';

Hi @Allen Andreas ,

it works only if i use catalog client script , i cannot use catalog client script because i should hide button for 20 catalog item , when i use this in client script don't work 

document.getElementById('oi_add_to_cart_button').style.visibility = 'hidden';

Hello,

You would add this as a catalog client script for the catalog items you wish to hide the button on. This should be treated as an edge case scenario and only done on specific catalog items in the manner I've described above. Then, you can disable it at any time for specific catalog items if the need changes once you've created it for that catalog item.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

ersureshbe
Giga Sage
Giga Sage

Hi, Why you are using client script to hide this. Instead you can use below step to hide

Go to Maintain Cart Layouts module and search for record with title "Order this Item". uncheck the "Add to cart checkbox" on the form.

Please mark as correct answer/helpful if it helped.

Regards,

Suresh.

Regards,
Suresh.