Dear gents,
I'm almost ready with my own online shop, but currently struggling with some little problems.
I would like to add a little string above the "put-into-cart"-button to give customers a short information.
After some hours of surching and testing I found this code, which works very well:
function customerinfo() {
echo '(This product is 0.5 m long.)';
}
add_action( 'woocommerce_before_add_to_cart_button', 'customerinfo' );
However, I would like to add this string only for one category, but not for all categories. Therefore, I tried to use:
function customerinfo() {
echo '(This product is 0.5 m long.)';
}
if ( is_product_category() ) {
if ( is_product_category('fabric') ) {
add_action( 'woocommerce_before_add_to_cart_button', 'customerinfo' );
}
Anyhow, it doesn't work. What's my thinking failure?
Many thanks for any help!
WordPress ...
ما را در سایت WordPress دنبال می کنید
برچسب : نویسنده : استخدام کار wpss بازدید : 342 تاريخ : چهارشنبه 20 مرداد 1395 ساعت: 7:02