By admin 12/09/2021 In Blog english, web development

Add custom HTML to all products except one category in Woocommerce

How to add custom HTML to all single product pages except products which belongs to a specific product category?

Add this function in your theme’s functions.php

Just change “127” with ID of category you want to exclude.And of course, change “custom text” part with desired HTML.

In the last line, number “15” will place your code between PRICE and EXCERPT. If you need custom text on some different place, find contentsingleproduct.php file and there in this part:

woocommerce product code

you will see the order of all elements on product page. You should just pick the number between some of that listed and custom code will be placed there.

Leave a reply

Call Now Button