jeudi 21 juin 2018

Using Woocommerce product category as condition in an if statement

I'm a novice when it comes to php and Woocommerce and I borrowed some code from somewhere to add a text after each price. I put this code in functions.php and it works fine.

But I want to use product category as a condition to determine whether the tex should be displayed or not.

See the following example:

if ( "ProductCategoryID == Something") {
    $textafter = '( Ex. Moms )'; //add your text
    return $price . '<span style="font-size: 14px; margin-left:10px; color:#E9483F" class="price-description">' . $textafter . '</span>';
}

Any help me with this condition will be appreciated?

Aucun commentaire:

Enregistrer un commentaire