woocommerce show attribute description when selecting a variable

Posted by user2916995 on Stack Overflow See other posts from Stack Overflow or by user2916995
Published on 2013-10-24T18:09:09Z Indexed on 2014/06/01 21:28 UTC
Read the original article Hit count: 148

Filed under:
|
|

I'm trying to figure out a way to display custom text based on the users selection of the variable product.

The attribute is 'pricing' and the tag is deposit - which I've added a text description to when adding the attribute. So I'm trying to make this text appear when the user selects 'deposit'

But the code I'm using in 'content-single-product.php' is displaying the text all the time no matter what variable is selected or not.

<?php $my_taxonomy = 'pa_pricing'; 

$terms = wp_get_post_terms( $post->ID, $my_taxonomy ); 

echo term_description($terms[0]->term_id, $my_taxonomy); 
 ?>

I only want the text to be displayed after the user has selected pricing 'deposit' Can someone help me with this?

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress