WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Can I set a product as "not for sale"? (10 posts)

  1. Narayanaya
    Member
    Posted 1 year ago #

    Hi,
    My customer has a real store. She wants all products to be shown on her webpage/shop but some are only available in the "real" store. Is there any way I can make products as not buyable in WooCommerce?

    Grateful for ALL help on this matter.

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

  2. helgatheviking
    Member
    Posted 1 year ago #

    they have an extension that transform woocommerce into a "catalog"
    http://www.woothemes.com/products/catalog-visibility-options/

    I don't know if that works on a product by product basis.

  3. bheadrick
    Member
    Posted 1 year ago #

    leave the price field blank and then it will only be for display without an add to cart button.

    Here's an example.

  4. Twansparant
    Member
    Posted 1 year ago #

    That solution doesn't work for me.
    I have variable products with colour swatches and all the prices left blank, but when selecting one of the colours, the add to cart div does show up.

  5. bheadrick
    Member
    Posted 1 year ago #

    link to the site in question?

  6. Twansparant
    Member
    Posted 1 year ago #

    The site is still under construction so can't give you access.
    I'm using the WooCommerce Color and Image Swatches extension and I noticed that it uses it's own single-product/variable.php template so maybe that's way your solution isn't working?
    Thanks!

  7. helgatheviking
    Member
    Posted 1 year ago #

    yeah empty price should also work, but i see in the default single-product/add-to-cart/variable.php template that there is no check for whether an item is_purchasable or not.... unlike with simple products.

    you could override the template with your theme and then wrap the

    <div class="single_variation_wrap" style="display:none;"> complete div with some conditional logic like so:

    <?php if ( $product->is_purchasable() ) { ?>
    
    	<div class="single_variation_wrap" style="display:none;">
    		<div class="single_variation"></div>
    		<div class="variations_button">
    			<input type="hidden" name="variation_id" value="" />
    			<?php woocommerce_quantity_input(); ?>
    			<button type="submit" class="single_add_to_cart_button button alt"><?php echo apply_filters('single_add_to_cart_text', __( 'Add to cart', 'woocommerce' ), $product->product_type); ?></button>
    		</div>
    	</div>
    	<div><input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" /></div>
    
    <?php } ?>
  8. Twansparant
    Member
    Posted 1 year ago #

    Thanks for your suggestion!

    However the WooCommerce Color and Image Swatches extension uses it's own template variable.php located in: plugins/woocommerce-variation-swatches-and-photos/templates/single-product/variable.php

    I tried copying this folder into my theme folder just like the woocommerce templates, but that doesn't work. It seems I can't override this template with my own theme and I don't really want to modify the core files of the plugin itself...

    Any thoughts on this?
    Thanks!

  9. helgatheviking
    Member
    Posted 1 year ago #

    so you copied /single-product/variable.php into your /woocommerce folder? that should work if the plugin is using woocommerce_get_template to get the template in the first place.... which I can't know without looking at their code. As an alternative you could unhook the function that is calling their template and then add your via a hook.

  10. bheadrick
    Member
    Posted 1 year ago #

    look at how the plugin hijacks the template files, and hijack them back to your theme. I'm sure you can do it fairly easily just by adding and removing action hooks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic