Okay
  Public Ticket #4540572
Tiered pricing and Quantity Steps
Closed

Comments

  •  1
    Danny Whitehead started the conversation

    Hi.

    Many of our products come in boxes of 6 cans. For our B2B groups, we currently use Minimum/Quantity steps so they can only buy in multiples of 6.

    Some smaller potential B2B customers need to buy fewer, so we'd like to allow that somehow, but I can't figure out the best way.

    Ideally, we'd set a regular price for 1-5 cans, and a tiered price discount for over 6. The problem with that is that they could buy 7, and get the discount on that 1 extra can. We'd like it so that once they're over the 6, they have to buy in multiples of 6.

    So we need either:

    1) Quantity rules that only kick in once they're over the 6 can threshold, or...

    2) Tiered pricing than only applies to multiples of the tier quantity.

    Is that possible with B2BKing's current features, or should this be a feature request?

    Thanks.

  •  2,724
    WebWizards replied

    Hi Danny,

    Glad to assist,

    You actually can create a quantity step rule that only kicks in above 6. To do that, go to B2BKing -> Dynamic Rules, create a "Required Multiple (Quantity Step)" rule with a step of 6, and under conditions set "Product Quantity > 5". Here's a screenshot for reference: https://prnt.sc/j8i1bGaKuPP2

    This way the customer can buy 1, 2, 3, 4, 5, 6, 12, 18, 24, etc. If they try to add something like 8 to the cart, it will show an error and won't let them proceed, but adding e.g. 4 or 12 would work fine.

    Another option (a bit more setup work) would be to create a variable product with 2 variations - one "Single" variation and one "Pack" variation. You'd then apply the quantity step rule only on the Pack variation, and you could set a better price on that variation as an incentive for buying in bulk.

     

    Kind regards,
    Stefan

  •  1
    Danny Whitehead replied

    Excellent! Really appreciate that. I thought there'd be a way that was something like the solution you suggest. I'll try it.

    Would there be any way to add products to this rule in bulk? I don't see a CSV import for Dynamic Rules.

    The duplicate product method is precisely what I posted this to avoid. It would potentially double the number of SKUs we have to administer. Our big sellers are already 50-250 variations (yep!), so adding extra variable attributes or duplicating them to 6-pack versions would be a nightmare. I know this because it's how it was set up when I started working here. That was mostly because the old ERP couldn't convert singles and cartons very well.

    I'll let you know it goes when I try to use this method on the dedicated B2B version of our site that I'm working on.

  •  2,724
    WebWizards replied

    Hi Danny,

    Thanks for the update!

    We don't have a full CSV import feature for rules just yet. It is coming soon - we're building a new Dynamic Rules panel (currently available under B2BKing -> Settings -> Early Access) which will have this.

    For now, to speed this up, you can try to use this button and paste a comma-separated list here: https://www.loom.com/share/6ef7e0cc5f71439498ece088ed35c4e9

    Let me know if I can help with anything,

    Kind regards,
    Stefan

  •  1
    Danny Whitehead replied

    Hi Stefan.

    I finally got to testing this, and it doesn't work as I need it to. I've set up the dynamic rule for a test product, and it still allows me to add, say, 7 to the basket via the Bulk Order Form. Also, the plus/minus button don't make the quantity step from 1, 2, 3, 4, 5, 6, 12, 24 and so on. You don't get the warning that it's an invalid quantity until you go to the basket page.

  •  2,724
    WebWizards replied

    Hi Danny,

    Thanks for getting back to me,

    Yes, the quantity validation from the dynamic rule is applied at the basket/checkout level, so it won't prevent someone from typing in an invalid number like 7 on the product page or bulk order form.

    To have the plus/minus buttons on the product page actually step through 1, 2, 3, 4, 5, 6, 12, 24 etc, that's tricky because there's no native HTML input attribute that supports that kind of progression. The standard "step" attribute only works with a fixed increment, so it can't handle "go up by 1 until 6, then jump by 6."

     

    The only way to achieve that would be with a custom JavaScript snippet. There's no built-in B2BKing feature for it, but a custom script could be feasible depending on your theme and setup. The script would need to target specific products or categories directly in the code.

    If you'd like to explore that option, could you share a URL to one of the product pages on your site? Since this would use a script, your theme would come into play depending on how it structures its qty fields, so I'd want to take a look at the page to determine how feasible that is.

     

    Kind regards,
    Stefan

  •   Danny Whitehead replied privately
  •  2,724
    WebWizards replied

    Hi Danny,

    Thanks for sharing that,

     

    Unfortunately I can't actually access the page, as I'd need a B2B user account to view it, but no worries - I went ahead and put together a custom snippet on my local test site that should handle this.

    add_action('wp_head', function(){
        // --- CONFIG: Add product IDs here ---
        $allowed_products = array(3866, 4765, 789);
    
        // Only output on single product pages for the specified IDs
        if ( ! is_product() ) return;
    
        global $post;
        if ( ! in_array( $post->ID, $allowed_products ) ) return;
    
        ?>
        <script>
            jQuery(document).ready(function($){
              $(document).on('change input', 'input.qty', function() {
                var $input = $(this),
                    val    = parseFloat($input.val()) || 1,
                    old    = parseFloat($input.data('prev')) || 1,
                    newVal;
                if (val <= 6) {
                  newVal = Math.max(1, Math.round(val));
                } else {
                  if (val > old) {
                    newVal = Math.ceil(val / 6) * 6;
                  } else {
                    newVal = Math.floor(val / 6) * 6;
                    if (newVal < 6) newVal = 6;
                  }
                }
                if (newVal !== val) {
                  $input.val(newVal);
                }
                $input.data('prev', newVal);
              });
              $(document).on('focus', 'input.qty', function() {
                $(this).data('prev', parseFloat($(this).val()) || 1);
              });
            });
        </script>
        <?php
    });

     

    You'd need to configure the product IDs at the top of the snippet. The way it works is it sets the quantity steps to 1, 2, 3, 4, 5, 6, 12, 18, 24, etc - basically it adds the step starting with qty 6.

    You can add this to your theme's functions.php or any code snippets plugin.

    Here's a quick video of how it works on my end: https://www.loom.com/share/1b259c5270974a6e929037c30eb0a2de

     

    That said, I should mention this is quite experimental, so if you decide to use it I'd definitely recommend doing some thorough testing first - check how it behaves on product pages, test simple products, variable products, etc.. to make sure everything works as you'd expect before going live with it.

     

    Kind regards,
    Stefan

  •  1
    Danny Whitehead replied

    Hi Stefan.

    I really appreciate your help on this.

    We've decided that the custom snippet approach probably isn't worth it for the number of different quantities we'd have to add snippets for, and the commercial benefit it would bring.

    We've decided to keep the existing minimum quantity and quantity steps for our main B2B groups, and created a new B2B group for customers who want to buy less than the minimum, but with a smaller discount.

    Thanks again,

    Danny

  •  2,724
    WebWizards replied

    Hi Danny,

    Thanks for the update.

    Perhaps we will directly add a built-in feature for this kind of dual quantity option on product pages. Possibly something that can also double as a "order a sample" feature - we are considering it.

     

    If you need anything, feel free to reach out.

    Kind regards,
    Stefan