Okay
  Public Ticket #4497992
Credit available display on front end
Closed

Comments

  •  1
    John started the conversation

    Hi,

    I'm trying to create a shortcode to return the available credit for the current user/group. How can I pull the data that is displayed in the 'Company Credit' tab on the user account?

    On a slightly related note, is there a way to for a subaccount to have their own credit? I want both the approval function and company credit, but the subaccounts uses the same pool of credits as the main. 

    If that's not possible, can the transaction history table be modified to show the user orders' name in the notes.

    Attached files:  Screenshot 2025-09-23 at 11.38.25 am.png

  •  2,535
    WebWizards replied

    Hi John,

    Thanks for reaching out. I've updated the credit add-on to add the shortcodes you mentioned,

    The attached version now includes these three new shortcodes:
    - [b2bking_outstanding_balance] - Displays the formatted outstanding balance value without label
    - [b2bking_available_credit] - Displays the formatted available credit value without label
    - [b2bking_credit_limit] - Displays the formatted credit limit value without label

    Regarding subaccounts having their own credit pools - I'm afraid that would be quite difficult to implement with the current architecture. However, I was able to add the user information to the transaction history table.

    To enable this:
    1. Please update to the attached version of the credit add-on
    2. Add this code snippet to your theme's functions.php or a code snippets plugin:

    add_filter('b2bking_show_credit_history_username_column', '__return_true');

    After that, you'll see a new "User" column in the transactions table showing which user placed each order, like this: https://prnt.sc/VWez75jGl4No

    Kind regards,
    Stefan

  •   WebWizards replied privately