I have this code that looks great and hides the add to cart button on catalog page.
This is how it looks. I dont want the prices to display
I want this same button to display on the single product page with a custom link and without displaying price.
This is the single product page button that i want to change
Code I'm currently using
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
function replacing_add_to_cart_button( $button, $product ) {
$button_text = __("Escríbenos", "woocommerce");
$button = '<a class="button" href="' . $product->get_permalink() . '">' .$button_text . '</a>';
return $button;
}
Is this possible?
To remove Add to Cart button on Single Product Page
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
To remove price
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
To add custom link as on your catalogs page
function replacing_single_add_to_cart_button() {
// Custom Link goes here
}
add_action( 'woocommerce_single_product_summary', 'replacing_single_add_to_cart_button', 30 );
I hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.