Buy B2BKing
$179 $129
You may want to add custom fields connected to user meta keys, available when a new subaccount is created.
You can use the following snippet:
add_action('b2bking_custom_new_subaccount_fields', function(){ ?> <br> <div class="b2bking_subaccounts_new_account_container_content_element"> <div class="b2bking_subaccounts_new_account_container_content_element_label"> <?php esc_html_e('Store Code','b2bking'); ?> </div> <input type="text" class="b2bking_subaccounts_new_account_container_content_element_text" name="b2bking_store_code" placeholder="<?php esc_attr_e('Enter the store code here...','b2bking'); ?>"> </div> <div class="b2bking_subaccounts_new_account_container_content_element b2bking_subaccount_horizontal_line"> <div class="b2bking_subaccounts_new_account_container_content_element_label"> <?php esc_html_e('Store ID','b2bking'); ?> </div> <input type="text" class="b2bking_subaccounts_new_account_container_content_element_text" name="b2bking_store_id" placeholder="<?php esc_attr_e('Enter the store id here...','b2bking'); ?>" > </div> <?php }); add_filter('b2bking_custom_new_subaccount_field_names', function($fields){ $fields = array('b2bking_store_code', 'b2bking_store_id'); return $fields; }, 10, 1); add_filter('b2bking_custom_field_meta', function($field_name){ // you can set a custom user meta key here if ($field_name === 'b2bking_store_code'){ $field_name = 'storecode'; } if ($field_name === 'b2bking_store_id'){ $field_name = 'storeid'; } return $field_name; }, 10, 1);
Explaining the snippet:
This snippet adds 2 fields there visually:
These fields are connected to the 'storecode' and 'storeid' user meta keys in our example.
Currently this only supports the "new subaccount" panel, but not the edit panel.
Powered by BetterDocs