Okay
  Public Ticket #4038243
Inclusive VAT Price Input + Accurate Exclusive Display Without Rounding Errors
Closed

Comments

  •  2
    Mark started the conversation

    Hi Stefan, 

    We recently switched to using B2BKing and immediately encountered a pricing issue that’s problematic for our B2B customers:

    Our workflow:
    • We enter product prices including VAT (e.g. €5.1775 at 9%)

    • We display prices excluding VAT (as B2B customers expect)

    • We need the calculations to be precise, with no rounding discrepancies

    Example:
    • €5.1775 (incl. 9% VAT) should neatly become €4.75 excl. VAT

    • 20 × €4.75 = €95.00 excl., €103.55 incl.

    • But WooCommerce shows €95.05 because B2BKing calculates with too many decimals (e.g. 4.7477...)

    What we need:

    A way to indicate that our price input includes VAT,
    so that B2BKing correctly rounds to 2 decimals,
    instead of calculating with raw unrounded values and showing incorrect totals.

    Suggestions:

    Could you provide any of the following?

    • A setting or option such as "Prices entered including VAT"

    • A way to round or adjust values inside the b2bking_get_product_price hook

    • Documentation or confirmation that the b2bking_rounding_precision filter still works, and how to use it correctly

    Thank you and regards,
    Mark Kokkelkoren
    Compass Digital

  •  2,486
    WebWizards replied

    Hi Mark,

     

    B2BKing itself does not handle pricing tax calculations - we only apply a standard WooCommerce function (WC()->customer->set_is_vat_exempt()) to exempt users from tax. 

     

    I'm not completely sure where the issue is there, i.e if it's a misconfiguration, or conflict, or something else.

    My best guess though is that it's probably the issue described here https://github.com/woocommerce/woocommerce/issues/27026 where a 0.01 discrepancy can be introduced when entering prices inc vat but displaying them ex vat.

     

    If that's it, the best way to solve that would be to enter prices for B2B users ex VAT.

    If your website is a mixed B2B + B2C site, I can provide you with a code snippet to set it so that b2c prices are entered inc vat but b2b prices are entered ex vat (meaning that when you edit the product you would have to set 5.1775 as the b2c regular price and 4.75 as the b2b regular price). 

     

    Let me know your thoughts. If it helps I can also take a look at the site directly if you can share a backend site access,

     

    Kind regards,

    Stefan