Skip to content
Advertisement

Refer to specific product ID in WordPress / WooCommerce in PHP

I have this script that adds a download button to every product page in WooCommerce but I need to exclude a product page from having the download button.

I tried changing the first line to

JavaScript

but it is failing, I think I am on the right track but need to reference it correctly (It should only enter the if function if is a product AND its not product ID 1514)

JavaScript

Thanks

Advertisement

Answer

One easy way to hide this would be to just use CSS.

if the theme is using the body_class() function then the page will have its own body class. Something like .postid-1514 and you can hide it using .postid-1514 .download { display: none; } this will completely hide it.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement