The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Display 'Add to Cart' button on product without price (5 posts)

  1. ormagon
    Posted 2 years ago #

    Dear support,

    Some of the products in my store are priceless, and I would like to keep it that way. The only problem is that the 'Add to Cart' button doesn't show up on a pricesless product, while I would like it to show. Giving the product a price of €0,- is not an option for me unfortunately. I googled the heck out of it cause it seemed like a pretty basic request. But the only thing turning up unfortunately is how to remove the 'Add to Cart' button :P.

    Kind regards,


  2. ormagon
    Posted 2 years ago #

    To specify it further, this is only needed for the .single_add_to_cart_button, not for variable products etcetera (hope this makes it easier).

    Kind regards,

  3. ManusH
    Posted 2 years ago #

    what exactly do you want; by using "priceless product" and "product price of $0.0 is not an option" in the same description?!?!

    Do you want to offer some "FREE" products? As a gift or some discount option?!?
    Or what do you expect from customers to do with such a product, just adding it into the cart, but not buying it?

  4. ansikun
    Posted 2 years ago #

    in the file "class-wc-shortcodes.php" (it's in the includes folder)
    change the line 491 "'show_price' => 'true'"
    from "true" to "false"

  5. terrytsang
    Posted 2 years ago #

    Hi @ormagon, i bet you want to show "Add to Cart" button although the price of product is 0 or empty, right.

    You can put this in your theme's functions.php:

    function custom_woocommerce_is_purchasable( $purchasable, $product ){
        if( $product->get_price() == 0 ||  $product->get_price() == '')
            $purchasable = true;
        return $purchasable;
    add_filter( 'woocommerce_is_purchasable', 'custom_woocommerce_is_purchasable', 10, 2 );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.