Conditional
-
I’m adding a function to display a message after the product short description. But I only want it to show if the product has a dependency. I’m not sure what I need to add to my function to do that… if ________________ (do my function). Can you point me in the right direction?
Though, looking at it now, I suppose I could just add your custom message field instead of my generic note below. Thoughts? ??
(I do know that it appears along the top when you click “add to cart”, but we’d like it to do display under the short description all the time on products that require it, so the user knows beforehand.)
Thank you!
add_filter('woocommerce_short_description','sf_add_text_short_descr'); function sf_add_text_short_descr($description){ if ( is_singular('product') ) { $text="<div class='dependency-box'>This item can only be added to your cart if you are purchasing or have already purchased a <a href='#'>Herd Share Membership</a>. Not sure? <a href='#'>Log in</a>!</div>"; return $description.$text; } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Conditional’ is closed to new replies.