WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Display 'Add to Cart' button on product without price (5 posts)

  1. ormagon
    Member
    Posted 6 months 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,

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

  2. ormagon
    Member
    Posted 5 months 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
    Member
    Posted 5 months 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
    Member
    Posted 1 month 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
    Member
    Posted 1 month 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 );

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.