Support » Plugin: WooCommerce » Remove 'add to cart' button for free products only

  • Hi,

    I am trying to remove the ‘add to cart’ button when the price = ‘For free’.

    For this I am using:

    if ($price == "For free") {
    		remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);

    This works but it will remove ALL the buttons from all products. I only want to remove the single ones though which do not have the price set as ‘For free’.

    Is there a way?

    PS: My free products don’t have the value 0, they have the value ‘For free’.

  • The topic ‘Remove 'add to cart' button for free products only’ is closed to new replies.