Okay
  Public Ticket #4512072
B2BKing – Attribute-Based Discount Rule Applying from First Item Instead of Minimum Quantity
Open

Comments

  •  2
    Vladislav started the conversation

    Hello B2BKing Team,

    We’re using B2BKing Pro and are trying to create a dynamic rule that applies a discount based on a product attribute (custom taxonomy) and the total quantity of products with that attribute in the cart.

    Our scenario

    We have several products (for example, shampoos) that share an attribute called “Volume” (pa_talpa) with several values such as 1000 ml, 3000 ml, 5000 ml.

    We created a rule that should apply a 50% discount when the cart contains at least 3 products with the same attribute value (for example, 3L).

    The issue

    At the moment, the rule applies immediately from the first product, even if there’s only one matching item in the cart.

    We need the system to sum all products that share the same attribute value (regardless of product ID) and only apply the discount when the combined quantity reaches the threshold (≥ 3).

    We have tried:

    • “Applies to selected products”

    • “Minimum quantity: 3”

    • Manually grouping products that share the same attribute value

    However, the discount is still applied from the first unit.
    When we use cart total quantity ≥ 3, it counts all cart items instead of only those matching the selected products or attributes.
    When selecting specific products, the rule checks each product individually instead of treating them as one group.

    What we’d like to confirm
    1. Does B2BKing currently support rules that apply based on product attributes (e.g., pa_talpa = 1000 ml), not just by category or specific product IDs?

    2. If not, could you please provide an official hook, snippet, or filter example that would allow us to:

      • count only the quantity of products with a specific attribute value in the cart;

      • apply the discount only when that quantity meets or exceeds a defined threshold?

    3. Is this functionality planned for any upcoming releases?

    This feature would be very important for us, as our pricing and promotions depend on product attributes such as size/volume, not only categories or individual product IDs.

    We can provide screenshots or a short video showing the current setup and results if needed.

    Thank you in advance for your help!

  •  2,595
    WebWizards replied

    Hi Vladislav,

    Unfortunately, B2BKing doesn't support attribute-based discount rules by default. The dynamic rules system is designed to work with products, categories, or tags. While it's technically possible to replace tags with a custom taxonomy, this wouldn't support conditions like minimum quantities the way you need.

    This is something we're planning to add in the future - we've received similar feedback about attribute-based discounts, and it will be part of an upcoming redesign of the dynamic rules system.

     

    For now, I might be able to help with a code snippet workaround. Will it work for you if we add this discount to the cart totals area (shown only at the end of cart/checkout)? This would be easiest - let me know and I will create a code snippet example that calculates discounts based on attributes like you mentioned (like pa_talpa = 1000ml + a min qty).

     

    Kind regards,
    Stefan

  •  2
    Vladislav replied

    🔹 How the system currently calculates

    At the moment, discounts are calculated from the B2B discounted price, not from the original B2C (regular) price.
    For example:

    • Regular (B2C) price = €100

    • B2B group discount = 30 % → the product price becomes €70

    • Then, when the attribute-based 50 % discount is applied, it’s calculated again from €70 → €35 final.

    What we need instead:

    • The 50 % discount should be calculated from the original B2C (regular) price, ignoring any existing B2B group discounts.

    • In the same example, 50 % of €100 = €50 final price (for all B2B groups).

    In other words, we want the snippet to always take the regular product price (get_regular_price()) as the discount base, not the customer’s already discounted B2B price. 🔹 What we need the snippet to do
    1. Count the combined quantity of all products sharing the same attribute value in the cart.

    2. Apply the discount only when that total quantity for a specific attribute value meets or exceeds the threshold (≥ 3).

    3. Treat each attribute value separately (e.g., 3×1000 ml triggers; 2×1000 ml + 1×3000 ml does not).

    4. Apply 50 % discount from the regular (B2C) price, shown as a cart total adjustment (negative fee), not by changing product line prices.

    5. The discount must not stack with other dynamic rules.

    6. Applies to B2B group “Hairdressers” and must support variable products (attribute on variation level).

    7. If possible, support multiple tiers later (e.g., 3 + → 50 %, 6 + → 55 %).

    Please also include information about which hook or action you attach the snippet to (for example woocommerce_cart_calculate_fees).

    Thanks again for your time and assistance — this functionality would make a big difference for us!

  •  2,595
    WebWizards replied

    Hi Vladislav,

    Thanks for the detailed explanation. Unfortunately what you're looking for is quite complex and not supported by B2BKing by default.

    The issue is that product discounts and cart discounts always stack in WooCommerce/B2BKing - I don't have a way for cart discounts to cancel or overwrite existing product line discounts.

    If you have existing B2B group discounts and want to add an attribute-based discount that overwrites those existing rule discounts, that's not something the plugin can handle currently.

     

    What I can help with is a custom snippet that adds a discount to the cart totals (as we discussed earlier). However, this discount would be added on top of existing discounts rather than replacing them. So if a product is already discounted to €70 through B2B rules, and we add a cart discount, it would stack rather than calculate from the original €100 price.

     

    Kind regards,
    Stefan

  •  2
    Vladislav replied

    Hi,

    Thank you for the information and your assistance. Since it’s currently not possible to achieve the discount logic we need with your plugin, we’ve decided to test an alternative solution. We are now trying the Flycart plugin, and their discount system works exactly the way we require.

    I would recommend taking a look at how their system is built — it’s very similar to yours, but certain scenarios are handled more efficiently and we haven’t encountered as many bugs or issues as we did here.

    Thank you again for your time.