Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 65051

ADD A BUTTON TO SPECIFIC CATEGORY PRODUCTS WOOCOMERCE

$
0
0

Replies: 1

Hi to all.

I have this function that add a second button to all products in woocomerce and i need that button only in a specific category. I know that i need to use the contitional tag is_product_category () but i dont know to use it.

All help is welcome.

Thanks in advance.

—————————————————————————
function patricks_woocommerce_call_to_order_button(){
global $product; //get the product object
if ( $product ) { // if there’s a product proceed
$url = esc_url( $product->get_permalink() ); //get the permalink to the product
echo ‘Pedir info‘; //display a button that goes to the product page
}
}
add_action(‘woocommerce_after_shop_loop_item’,’patricks_woocommerce_call_to_order_button’, 10);
—————————————————————————-


Viewing all articles
Browse latest Browse all 65051

Latest Images

Trending Articles



Latest Images