WooCommerce - excelling eCommerce
Specific Number of items with inventory (5 posts)

  1. meekree
    Posted 2 years ago #

    I am setting up an ecommerce site selling fish. Right now customers can select how many fish they want. I want to sell in specific amounts and and keep the inventory system working.

    I cannot figure out how to get both of these things to work.



  2. bheadrick
    Posted 2 years ago #

    So, for example, you want to sell packages of 5 fish, and have the inventory system treat that as 5 fish and not 1 package of 5 fish?

    You can edit the quantity.php template file under single-product/add-to-cart/ (under your theme) and use the step attribute along with a meta field, so it would look something like this:

    <div class="quantity"><input name="<?php echo $input_name; ?>" data-min="<?php echo $min_value; ?>" data-max="<?php echo $max_value; ?>" value="<?php echo $input_value; ?>" size="4" title="Qty" step="<?php echo get_post_meta(get_the_id(),'package_size',true);?>"class="input-text qty text" maxlength="12" /></div>

    if you set meta field "package_size" to a value of 5, then the + button would count by fives.

  3. meekree
    Posted 2 years ago #

    Is there a way to make the products have different values? So one could count by 2s and another by 5s.


  4. bheadrick
    Posted 2 years ago #

    yeah, that's why I suggested you use a postmeta field so you could have different products increment at different rates.

  5. shpilya
    Posted 2 years ago #

    @ Bheadrick
    Increment working properly)))
    Help please: How can I show the initial default value if it is too different for products?
    How do I use a postmeta field?
    Thank you for the quick response.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic