How can I replace the “Add to cart” button with an “Call to order” button and stop working on some product?

I am using woocommerce plugin in a wordpress site to sell some products. There are two types of products. some products will have add to cart button, but some will have call to order button instead of add to cart. But Both type of products will show the price and discounted price.

I am using some code to change the text

Read More
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );

function woo_custom_cart_button_text() {

return __( 'Call to order', 'woocommerce' );

}

that works. But I when I am using this code to change the url or say stop the button to add to cart that is not working.

    add_filter( 'woocommerce_product_add_to_cart_url', 'woo_more_info_link' );
function woo_more_info_link( $link ) {
global $product; // switches link in all cases, i.e. in plugins
$link = get_permalink( $product->id );
return $link;
}

I actually want that the add to cart button should not working and should say only call to order.

Can anybody tell me how to stop add to cart from working.

Related posts

Leave a Reply