Public Ticket #2887664

Feature exists?

Closed
Comments
1 Ticket
Pedro Alfredo Linares Kcomt started the conversation 5 years ago on October 5, 2021 at 1:41pm

Hi, we are implementing b2b king in our webpage, we have 3 subaccounts for a B2B Client, 1 buyer and 2 logistics. Logistics creates purchase lists and the buyer is the one who approve the purchasing and creates the new order. We would like to know if there is a functionality to support email notification or something similar to send to buyer when any of the logistics place a new purchase list. Even if there is another plugin to accomplish this task or there are an alternative to let the buyer knows a new purchase list is placed is fine for us. Thanks.

2,762
KingsPlugins replied 5 years ago on October 5, 2021 at 3:10pm

Hi Pedro,

Thank you for purchasing our plugin,

I wrote a snippet to assist you with this. Please try to add the below snippet as a PHP snippet to your site:

add_action('b2bking_purchase_list_created', function($purchase_list_id, $user_id){
    // if user is subaccount, notify parent account
    $account_type = get_user_meta($user_id,'b2bking_account_type', true);
    if ($account_type === 'subaccount'){
        $parent_user_id = get_user_meta($user_id, 'b2bking_account_parent', true);
        $parent_obj = get_userdata($parent_user_id);
        do_action( 'b2bking_new_message', $parent_obj->user_email, 'One of your subaccounts has created a new purchase list', $user_id, 0 );
    }
}, 10, 2);

To add a PHP snippet:

https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/

The result is that the parent account will be emailed when a subaccount creates a purchase list.

Email looks like this:

4890406951.png

If the above does not work for you, please make sure to update to the latest plugin version 3.8.6 from CodeCanyon.

Kind regards,

Stefan

Sign In