• How to show text based on quantity selected in Woocommerce?

    I’m trying to show our manufacturing time for our products.

    For example,
    Qty 1-5, show 5 days manufacturing time.
    Qty 6-10, show 7 days manufacturing time.
    Qty 11+, show 10 days manufacturing time.

    Any ideas on how you would do this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The “easy” way is to use jQuery (or your JS tool of choice) to hook into the quantity fields update actions, and display a value/element based on the value. If you know your way around JavaScript it’s not too hard.

    Thread Starter stan255

    (@stan255)

    Hi @catacaustic thanks for the help.

    Where would you start learning on doing Woocommerce customizations like this?

    This is my quantity HTML

    <div class="quantity">
    		<label class="screen-reader-text" for="quantity_5cecb413c9597">Quantity</label>
    		<input type="number" id="quantity_5cecb413c9597" class="input-text qty text" step="1" min="1" max="" name="quantity" value="1" title="Qty" size="4" inputmode="numeric">
    	</div>

    Start by learning about jQuery, and the functions that it adds. It is one of the easiest to learn, so shouldn’t be too hard to do. As a bonus it’s already part of WordPress so there’s no extra things to add.

    Thread Starter stan255

    (@stan255)

    How about hooking into the quantity fields and update actions? Where can I learn that?

    jQuery… That’s the backbone of it all. https://jquery.com/

    Honestly, I would keep it simple and just copy and paste those times as you have them here in the short description…

    But if you want the fancy, then I think you can try with a variable product and add a description for each variation.

    Thread Starter stan255

    (@stan255)

    @webmasterhouston That’s a unique way of doing it however those manufacturing times are based on the quantity selected.

    UPDATE: I tried it and it doesn’t look too bad! Screenshot – https://prnt.sc/nu92pr

    • This reply was modified 5 years, 6 months ago by stan255.
    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Moved to Fixing WordPress, this is not a Developing with WordPress topic. For plugin specific help please use that plugin’s support sub-forum instead.

    https://www.ads-software.com/support/plugin/woocommerce/#new-post

    Is that the short description? It looks good enough to me, as it communicates the info right upfront.

    **********************
    Here a somewhat pointless rambling:

    I have being thinking about this question of yours…

    I kinda contemplate the option of having some sort of shipping classes and see if can work it that way… no sure about that solution neither…

    What I realize is that you are talking about manufacturing time… and this is field that is not part of woo-commerce… there are ways to create custom fields, such as plugins and the so… but… to link them to the product count…

    I think part of the problem is that people usually don’t want to punish costumers for buying more, so nobody have develop plugins for that effect… most of what I find is for instance reducing the price of the product as the quantity increase… stuff like that… trying to motivate them to buy more.

    I get it you are manufacturing on a pulling fashion, you have not stack and create the product as the orders are placed… what would you do if 10 costumers place orders of 5 each? are you still going to deliver within 5 days the 50 of them? or your process is maxed out this way?

    In that case I would just suggest to email the costumer with the schedule time for his order.

    Thread Starter stan255

    (@stan255)

    @webmasterhouston Yes, I used the short description to communicate the lead time upfront.

    The ideal solution for us is to input a quantity range and associate a lead time to that.

    For example,
    Qty
    1 to 5 = 2 days lead time
    6 to 10 = 5 days lead time
    11 to 20 = 10 days lead time
    21 to 100 = 14 days lead time

    If the user orders multiple products, we would take the product with the highest lead time.

    Product 1 requires 5 days.
    Product 2 requires 2 days.

    We would show a 5 days lead time. This is to set the expectation of the worst case scenario.

    I still haven’t found a solution though. I might need to get this custom built.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Show text based on quantity selected in Woocommerce’ is closed to new replies.