ADD A BUTTON TO SPECIFIC CATEGORY PRODUCTS WOOCOMERCE
-
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);
—————————————————————————-
- The topic ‘ADD A BUTTON TO SPECIFIC CATEGORY PRODUCTS WOOCOMERCE’ is closed to new replies.