WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Hide 'plus' and 'minus' symbols for (6 posts)

  1. torndownunit
    Member
    Posted 1 year ago #

    My page is here: http://www.mochaberry.ca/shop/mochaberry-house-blend-fair-trade-organic-1lb . Something with the CSS and the theme aren't playing nicely together, and the add/minus buttons for add to card don't display correctly. Is there anyway I can just hide these buttons? I have tried using Firebug to isolate them, but whatever I do either has no effect, or hides the entire field (buttons and numbers).

    Thanks

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

  2. FishFush
    Member
    Posted 1 year ago #

    I'm also curious to hear how to hide both the +/- buttons and the quantity number (I only sell one of each product and having a quantity makes it look like it's mass produced when it's not).

  3. helgatheviking
    Member
    Posted 1 year ago #

    There are a couple of solutions here. Unfortunately neither are as simple as this ought to be. I think this is a good idea though, so I am going to submit it to Github ( where WC does its development )

    https://github.com/woothemes/woocommerce/issues

    The first option involves involves adding a meta field somewhere in the product date metabox and then using that value to toggle the woocommerce_is_sold_individually filter.

    The status of woocommerce_is_sold_individually is the condition that displays the quantity input on the single product page. True = hide that input and False = display the input. This is the development-side solution though, and I might even send them a pull request if I get a minute to fix it.

    In the mean time you can override every woo template in your own theme. In your theme's folder create a folder called: woocommerce

    Then create a folder inside that called single-product

    Then inside that, add-to-cart

    Basically we're going to mimic the folder structure inside the templates folder of the Woocommerce plugin files. Now go into the WooCommerce plugin files and find the file

    templates\single-product\add-to-cart\simple.php

    COPY it. and then paste it into the

    woocommerce\single-product\add-to-cart\

    folder we created earlier.

    Anything you do to the simple.php file nested in your theme folder will now be displayed in lieu of WooCommerce's version. (this is called Template Hierarchy by the way)

    in your version (DO NOT HACK THE WOOCOMMERCE FILES!!) find the following:

    <?php
       if ( ! $product->is_sold_individually() )
    	 			woocommerce_quantity_input( array( 'min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity() ) );
    ?>

    and delete it. The quantity input is now gone. The downside of this is that it is gone for every product you sell, which is why the development-side solution will be better.

  4. helgatheviking
    Member
    Posted 1 year ago #

    For your further information I have submitted the patch to WooCommerce: https://github.com/woothemes/woocommerce/pull/1602

    We shall see if it is merged into core. If not, then I have a already explained how to override the WC template file.

  5. helgatheviking
    Member
    Posted 1 year ago #

    -edited because I was reading github's commit history incorrectly. I'm still hopeful that when the Woo Team is back from their Woo Trip, this will make it into version 1.7.

  6. helgatheviking
    Member
    Posted 1 year ago #

    a heads up that my solution was merged into 1.7beta
    https://github.com/woothemes/woocommerce/pull/1673

    so in the next release you will be able to mark products in the backend as individual/unique and the quantity input will disappear automatically.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.