Hello BB Builders,
I already have a woocommerce single product theme layout, but i want to change the add to cart button, for example if price is 0, or if a product have stock, using code like this:
add_filter('woocommerce_get_price_html', 'requestQuote', 10, 2);
function requestQuote($price, $product) {
if ( $price == wc_price( 0.00 ) ){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
return "<div class='elementor-button-wrapper'>
<a href='######' class='button-link size-sm' role='button'>
<span class='button-content-wrapper'>
<span class='button-text'>Request Quote</span>
</span>
</a>
</div>";
}
else{
return $price;
}
}
if i disable themer layout for single product, it works.
then i want to know how to make this, but without losing themer layout desing
thank you