Issue
When I try to hide the 'Add to cart' button, the variations disappear.
Solution
Here is the way to remove add to cart button and quantities in Single product pages for variable products only, keeping the attributes select fields:
add_action( 'woocommerce_single_product_summary', 'hide_add_to_cart_button_variable_product', 1, 0 );
function hide_add_to_cart_button_variable_product() {
// Removing add to cart button and quantities only
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Tested and works.
Answered By - LoicTheAztec Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.