Skip to content
Advertisement

Woocommerce show custom button in specific category

It’s possible to show this code only on a specific category ?

thank you!

JavaScript

Advertisement

Answer

JavaScript
  1. The function cmk_additional_button do a conditional check whether the current product have allowed categories id.
  2. If it have then displays the button.
  3. Function allowed_categories is return an array of allowed category which is used to compare with the current single product’s categories.
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement