I'm using a plugin called "one click chat to order" to order products via whatsapp and I've hided the add to cart button on single product page for all products. I've to show add to cart button only if the product weight is lesser than 50kg.
need to show add to cart button after the quote button here. I've used this snippet to hide add to cart button based on my condition. But it hides the whatsapp quote button as well. I don't know why?
add_action( 'woocommerce_single_product_summary', 'action_single_product_summary_callback', 1 );
function action_single_product_summary_callback() {
global $product;
$weight = $product->get_weight();
preg_replace('/\D/', '', $weight);
if ( $weight > 50 ) {
// For variable product types
if( $product->is_type( 'variable' ) ) {
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
}
// For all other product types
else {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
I'm new to woocommerce. Kindly help to solve this.
variable
? – Bhautik