WooCommerce - excelling eCommerce
Remove 'add to cart' button for free products only (1 post)

  1. Raider000
    Posted 2 years ago #


    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'.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.