I am trying to have the "Add to Cart" button change to "Make an Inquiry" and I would like that to link to either a tab further down the page or to a separate page all together. I would like this change to be based on availibilty or whether or not the price is listed.I already have a basic understanding on how to change the link and text conditionally, but just not based on the parameters and to the scope I need.
I know this response is incredibly late but below is what I have. The problem I have is that it is not in the position of the the original add to cart button, and its too wide.
add_action('woocommerce_single_product_summary','replace_add_to_cart');
function replace_add_to_cart() {
global $product;
if ( ! $product->is_in_stock() ){
remove_action( 'woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 );
add_action( 'woocommerce_single_product_summary','consult_bezambar_expert', 30 );
function consult_bezambar_expert() {
global $product;
echo '<form action="' . esc_url($product->get_permalink( "#tab- reviews" )) . '" method="get">
<button type="submit" class="single_add_to_cart_button button alt">Consult Bez Ambar Expert</button>
</form>';
}
}
}