WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Raider000
    Member
    Posted 9 months ago #

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

    http://wordpress.org/plugins/woocommerce/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.