BFCM Sale is Live! Grab 24% OFF on Your Favorite Plugins – Use Code BFCM24
View Categories

Developer Documentation

46 min read

Table of Contents

Action #

Action: before_agent_details_list_table #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after menu registration. You can use this action to perform tasks such as additional menu setup, initialization of menu-related components, or displaying messages to users after menu registration.

You can use this action to perform tasks such as additional setup, initialization of components,or modifying the output before the table is displayed.

function custom_before_agent_details_list_table_callback() {
    // Update an option in the database
    update_option('custom_agent_details_last_rendered', current_time('mysql'));

    // Retrieve the updated option
    $last_rendered = get_option('custom_agent_details_last_rendered');

    // Display a message based on the updated option
    echo '<div class="updated"><p>Agent details list table was last rendered at: ' . esc_html($last_rendered) . '</p></div>';
}
add_action('before_agent_details_list_table', 'custom_before_agent_details_list_table_callback');

Action: after_agent_details_list_table #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the agent details list table is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components,or modifying the output before the table is displayed.

function custom_after_agent_details_list_table_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Agent Details List Table</div>';
}
add_action('after_agent_details_list_table', 'custom_after_agent_details_list_table_callback');

Action: safw_email_assign_agent_to_group #

  • Data Type
    • $agents (array) : List of agents assigned to the group.
    • $post (WP_Post) : The post object related to the group assignment.
  • Arguments
    • $agents: An array containing the agents assigned to the group.
    • $post: The post object related to the group assignment.
  • Usage
    • This action allows you to execute custom functionality when agents are assigned to a group via email.

You can use this action to perform tasks such as sending notifications, logging assignments, or modifying the assignment process.

function custom_safw_email_assign_agent_to_group_callback($agents, $post) {
    // Your custom functionality here
    foreach ($agents as $agent) {
        // Example: Log the assignment
        error_log('Agent ' . $agent . ' assigned to group related to post ' . $post->ID);
    }
}
add_action('safw_email_assign_agent_to_group', 'custom_safw_email_assign_agent_to_group_callback', 10, 2);

Action: safw_payout_status #

  • Data Type
    • $agent_id (int) : ID of the agent.
    • $commission_amount (float) : The commission amount.
  • Arguments
    • $agent_id: The ID of the agent.
    • $commission_amount: The commission amount.
  • Usage
    • This action allows you to execute custom functionality when the payout status changes.

You can use this action to perform tasks such as sending notifications, updating records, or
modifying the payout process.

function custom_safw_payout_status_callback($agent_id, $commission_amount) {
    // Your custom functionality here
    error_log('Payout status changed for agent ' . $agent_id . ' with commission amount ' . $commission_amount);
}
add_action('safw_payout_status', 'custom_safw_payout_status_callback', 10, 2);

Action: save_update_commission #

  • Data Type
    • $commission_id (int) : ID of the commission.
    • $agent_id (int) : ID of the agent.
  • Arguments
    • $commission_id: The ID of the commission.
    • $agent_id: The ID of the agent.
  • Usage
    • This action allows you to execute custom functionality when a commission is saved or updated.

You can use this action to perform tasks such as updating records, sending notifications, or
modifying the commission process.

function custom_save_update_commission_callback($commission_id, $agent_id) {
    // Your custom functionality here
    error_log('Commission ' . $commission_id . ' saved or updated for agent ' . $agent_id);
}
add_action('save_update_commission', 'custom_save_update_commission_callback', 10, 2);

Action: before_edit_form_of_commission #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the edit form of a commission is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the form is displayed.

function custom_before_edit_form_of_commission_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Edit Form Of Commission</div>';
}
add_action('before_edit_form_of_commission', 'custom_before_edit_form_of_commission_callback');

Action: after_edit_form_of_commission #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the edit form of a commission is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the form is displayed.

function custom_after_edit_form_of_commission_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Edit Form Of Commission</div>';
}
add_action('after_edit_form_of_commission', 'custom_after_edit_form_of_commission_callback');

Action: before_edit_form_of_payout #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the edit form of a payout is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the form is displayed.

function custom_before_edit_form_of_payout_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Edit Form Of Payout</div>';
}
add_action('before_edit_form_of_payout', 'custom_before_edit_form_of_payout_callback');

Action: after_edit_form_of_payout #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the edit form of a payout is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the form is displayed.

function custom_after_edit_form_of_payout_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Edit Form Of Payout</div>';
}
add_action('after_edit_form_of_payout', 'custom_after_edit_form_of_payout_callback');

Action: before_edit_subcommission_view #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the edit view of a subcommission is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output after the view is displayed.

unction custom_after_edit_subcommission_view_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Edit Subcommission View</div>';
}
add_action('after_edit_subcommission_view', 'custom_after_edit_subcommission_view_callback');

Action: after_edit_subcommission_view #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the payout list table is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the table is displayed.

function custom_before_edit_subcommission_view_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Edit Subcommission View</div>';
}
add_action('before_edit_subcommission_view', 'custom_before_edit_subcommission_view_callback');

Action: before_payout_list_table #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the payout list table is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the table is displayed.

function custom_after_edit_subcommission_view_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Edit Subcommission View</div>';
}
add_action('after_edit_subcommission_view', 'custom_after_edit_subcommission_view_callback');

Action: after_payout_list_table #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the payout list table is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the table is displayed.

function custom_after_payout_list_table_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Payout List Table</div>';
}
add_action('after_payout_list_table', 'custom_after_payout_list_table_callback');

Action: before_customer_details_data #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the customer details data is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the data is displayed.

function custom_before_customer_details_data_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Customer Details Data</div>';
}
add_action('before_customer_details_data', 'custom_before_customer_details_data_callback');

Action: after_customer_details_data #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the customer details data is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the data is displayed.

function custom_after_customer_details_data_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Customer Details Data</div>';
}
add_action('after_customer_details_data', 'custom_after_customer_details_data_callback');

Action: after_list_orders_customer #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the list of orders for a customer is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the data is displayed.

function custom_after_list_orders_customer_callback() {    
// Your custom functionality here
    echo '<div class="notice">Custom Notice After List Orders Customer</div>';
}
add_action('after_list_orders_customer', 'custom_after_list_orders_customer_callback');

Action: before_widget_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the widget dashboard data for the month is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the data is displayed.

function custom_before_widget_dashbord_data_monthly_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Widget Dashboard Data Monthly</div>';
}
add_action('before_widget_dashbord_data_monthly', 'custom_before_widget_dashbord_data_monthly_callback');

Action: after_widget_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the widget dashboard data for the month is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output before the data is displayed.

function custom_after_widget_dashbord_data_monthly_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Widget Dashboard Data Monthly</div>';
}
add_action('after_widget_dashbord_data_monthly', 'custom_after_widget_dashbord_data_monthly_callback');

Action: before_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the dashboard data for the month is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the data is displayed.

function custom_before_dashbord_data_monthly_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Dashboard Data Monthly</div>';
}
add_action('before_dashbord_data_monthly', 'custom_before_dashbord_data_monthly_callback');

Action: after_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the dashboard data for the month is rendered.

You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output before the data is displayed.

function custom_after_dashbord_data_monthly_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Dashboard Data Monthly</div>';
}
add_action('after_dashbord_data_monthly', 'custom_after_dashbord_data_monthly_callback');

 Action: safw_email_on_order #

  • Data Type
    • $order_id (int) : The order ID.
    • $agent_id (int) : The agent ID.
    • $order (WC_Order) : The order object.
  • Arguments
    • $order_id: The order ID.
    • $agent_id: The agent ID.
    • $order: The order object.
  • Usage
    • This action allows you to execute custom functionality when an order is processed via email.

You can use this action to perform tasks such as sending notifications, updating records, or
modifying the order process.

function custom_safw_email_on_order_callback($order_id, $agent_id, $order) {
    // Your custom functionality here
    error_log('Email sent for order ' . $order_id . ' to agent ' . $agent_id);
}
add_action('safw_email_on_order', 'custom_safw_email_on_order_callback', 10, 3);

Action: wc_gent_order_checkout_processed #

  • Data Type
    • $agent_id (int) : The agent ID.
    • $commission (float) : The commission amount.
    • $order (WC_Order) : The order object.
  • Arguments
    • $agent_id: The agent ID.
    • $commission: The commission amount.
    • $order: The order object.
  • Usage
    • This action allows you to execute custom functionality when an order checkout is processed.

You can use this action to perform tasks such as updating records, sending notifications, or
modifying the order process.

function custom_wc_gent_order_checkout_processed_callback($agent_id, $commission, $order) {
    // Your custom functionality here
    error_log('Order checkout processed for agent ' . $agent_id . ' with commission ' . $commission);
}
add_action('wc_gent_order_checkout_processed', 'custom_wc_gent_order_checkout_processed_callback', 10, 3);

Action: sales_agent_add_order_meta #

  • Data Type
    • $post_id (int) : The post ID.
    • $order (WC_Order) : The order object.
    • $user_id (int) : The user ID.
    • $sales_agent (object) : The sales agent object.
    • $old_agent (object) : The old agent object.
    • $WC_Agent_Commission_Data_Store (object) : The commission data store object.
  • Arguments
    • $post_id: The post ID.
    • $order: The order object.
    • $user_id: The user ID.
    • $sales_agent: The sales agent object.
    • $old_agent: The old agent object.
    • $WC_Agent_Commission_Data_Store: The commission data store object.
  • Usage
    • This action allows you to execute custom functionality when order meta is added for a sales agent.

You can use this action to perform tasks such as updating records, sending notifications, or
modifying the order process.

function custom_sales_agent_add_order_meta_callback($post_id, $order, $user_id, $sales_agent, $old_agent, $WC_Agent_Commission_Data_Store) {
    // Your custom functionality here
    error_log('Order meta added for post ' . $post_id . ' and user ' . $user_id);
}
add_action('sales_agent_add_order_meta', 'custom_sales_agent_add_order_meta_callback', 10, 6);

Action: sales_agent_add_order_meta #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the user registration form is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the form is displayed.

function custom_wc_user_registration_before_form_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before User Registration Form</div>';
}
add_action('wc_user_registration_before_form', 'custom_wc_user_registration_before_form_callback');

Action: wc_agent_registration_after_form #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the agent registration form is rendered.

 You can use this action to perform tasks such as additional teardown, cleanup of components, or modifying the output after the form is displayed.

function custom_wc_agent_registration_after_form_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice After Agent Registration Form</div>';
}
add_action('wc_agent_registration_after_form', 'custom_wc_agent_registration_after_form_callback');

Action: safw_email_assign_agent #

  • Data Type
    • $user_id (int) : The user ID.
    • $post_id (int) : The post ID.
  • Arguments
    • $user_id: The user ID.
    • $post_id: The post ID.
  • Usage
    • This action allows you to execute custom functionality when an agent is assigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_agent_callback($user_id, $post_id) {
    // Your custom functionality here
    error_log('Agent ' . $user_id . ' assigned to post ' . $post_id);
}
add_action('safw_email_assign_agent', 'custom_safw_email_assign_agent_callback', 10, 2);

Action: wc_agent_registration_list_before #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the agent registration list is rendered.

You can use this action to perform tasks such as additional setup, initialization of components, or modifying the output before the list is displayed.

function custom_wc_agent_registration_list_before_callback() {
    // Your custom functionality here
    echo '<div class="notice">Custom Notice Before Agent Registration List</div>';
}
add_action('wc_agent_registration_list_before', 'custom_wc_agent_registration_list_before_callback');

Action: safw_email_assign_agent #

  • Data Type
    • $user_id (int) : The user ID.
    • $agent_filter (string) : The agent filter text field.
  • Arguments
    • $user_id: The user ID.
    • $agent_filter: The agent filter text field.
  • Usage
    • This action allows you to execute custom functionality when an agent is assigned via email with a filter.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_agent_filtered_callback($user_id, $agent_filter) {
    // Your custom functionality here
    error_log('Agent ' . $user_id . ' assigned with filter ' . $agent_filter);
}
add_action('safw_email_assign_agent', 'custom_safw_email_assign_agent_filtered_callback', 10, 2);

Action: after_add_commission_row #

  • Data Type
    • $commission_id (int) : The commission ID.
    • $args (array) : Arguments related to the commission row.
  • Arguments
    • $commission_id: The commission ID.
    • $args: Arguments related to the commission row.
  • Usage
    • This action allows you to execute custom functionality after a commission row is added.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the commission row process.

function custom_after_add_commission_row_callback($commission_id, $args) {
    // Your custom functionality here
    error_log('Commission row added with ID ' . $commission_id);
}
add_action('after_add_commission_row', 'custom_after_add_commission_row_callback', 10, 2);

Action: after_update_commission_row #

  • Data Type
    • $update_args (array) : Arguments related to the update.
    • $where (array) : Where conditions for the update.
  • Arguments
    • $update_args: Arguments related to the update.
    • $where: Where conditions for the update
  • Usage
    • This action allows you to execute custom functionality after a commission row is updated.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the update process.

function custom_after_update_commission_row_callback($update_args, $where) {
    // Your custom functionality here
    error_log('Commission row updated with args ' . json_encode($update_args));
}
add_action('after_update_commission_row', 'custom_after_update_commission_row_callback', 10, 2);

Action: wc_agentafter_delete_commission_row #

  • Data Type
    • $delete_commission_id (int) : The ID of the commission to be deleted.
  • Arguments
    • $delete_commission_id: The ID of the commission to be deleted.
  • Usage
    • This action allows you to execute custom functionality after a commission row is deleted.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the deletion process.

function custom_wc_agentafter_delete_commission_row_callback($delete_commission_id) {
    // Your custom functionality here
    error_log('Commission row deleted with ID ' . $delete_commission_id);
}
add_action('wc_agentafter_delete_commission_row', 'custom_wc_agentafter_delete_commission_row_callback', 10);

Action: after_add_subcommission_row #

  • Data Type
    • $sub_commission_id (int) : The sub-commission ID.
    • $args (array) : Arguments related to the sub-commission row.
  • Arguments
    • $sub_commission_id: The sub-commission ID.
    • $args: Arguments related to the sub-commission row.
  • Usage
    • This action allows you to execute custom functionality after a sub-commission row is added.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the sub-commission row process.

function custom_after_add_subcommission_row_callback($sub_commission_id, $args) {
    // Your custom functionality here
    error_log('Sub-commission row added with ID ' . $sub_commission_id);
}
add_action('after_add_subcommission_row', 'custom_after_add_subcommission_row_callback', 10, 2)

Action: after_update_subcommission_row #

  • Data Type
    • $update_args (array) : Arguments related to the update.
    • $where (array) : Where conditions for the update.
  • Arguments
    • $update_args: Arguments related to the update.
    • $where: Where conditions for the update.
  • Usage
    • This action allows you to execute custom functionality after a sub-commission row is updated.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the update process.

function custom_after_update_subcommission_row_callback($update_args, $where) {
    // Your custom functionality here
    error_log('Sub-commission row updated with args ' . json_encode($update_args));
}
add_action('after_update_subcommission_row', 'custom_after_update_subcommission_row_callback', 10, 2);

Action: wc_agentafter_delete_subcommission_row #

  • Data Type
    • $delete_commission_id (int) : The ID of the commission to be deleted.
  • Arguments
    • $delete_commission_id: The ID of the commission to be deleted.
  • Usage
    • This action allows you to execute custom functionality after a sub-commission row is deleted.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the deletion process.

function custom_wc_agentafter_delete_subcommission_row_callback($delete_commission_id) {
    // Your custom functionality here
    error_log('Sub-commission row deleted with ID ' . $delete_commission_id);
}
add_action('wc_agentafter_delete_subcommission_row', 'custom_wc_agentafter_delete_subcommission_row_callback', 10);

Action: wc_agentafter_delete_subcommission_row #

  • Data Type
    • $auth_cookie (string) : The authentication cookie.
    • $expiration (int) : The expiration time.
    • $old_user_id (int) : The old user ID.
    • $scheme (string) : The scheme.
    • $token (string) : The token.
  • Arguments
    • $auth_cookie: The authentication cookie.
    • $expiration: The expiration time.
    • $old_user_id: The old user ID.
    • $scheme: The scheme.
    • $token: The token.
  • Usage
    • This action allows you to execute custom functionality when the user switching cookie is set.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the cookie setting process.

function custom_set_wc_agent_user_switching_cookie_callback($auth_cookie, $expiration, $old_user_id, $scheme, $token) {
    // Your custom functionality here
    error_log('User switching cookie set for user ' . $old_user_id);
}
add_action('set_wc_agent_user_switching_cookie', 'custom_set_wc_agent_user_switching_cookie_callback', 10, 5);

Action: set_olduser_cookie #

  • Data Type
    • $auth_cookie (string) : The authentication cookie.
    • $expiration (int) : The expiration time.
    • $old_user_id (int) : The old user ID.
    • $scheme (string) : The scheme.
    • $token (string) : The token.
  • Arguments
    • $olduser_cookie: The old user cookie.
    • $expiration: The expiration time.
    • $old_user_id: The old user ID.
    • $scheme: The scheme.
    • $token: The token.
  • Usage
    • This action allows you to execute custom functionality when the old user cookie is set.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the cookie setting process.

function custom_set_olduser_cookie_callback($olduser_cookie, $expiration, $old_user_id, $scheme, $token) {
    // Your custom functionality here
    error_log('Old user cookie set for user ' . $old_user_id);
}
add_action('set_olduser_cookie', 'custom_set_olduser_cookie_callback', 10, 5);

Action: clear_olduser_cookie #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality when the old user cookie is cleared.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the cookie clearing process.

function custom_clear_olduser_cookie_callback() {
    // Your custom functionality here
    error_log('Old user cookie cleared');
}
add_action('clear_olduser_cookie', 'custom_clear_olduser_cookie_callback');

Action: set_auth_cookie #

  • Data Type
    • $auth_cookie (string) : The authentication cookie.
    • $expire (int) : The expiration time.
    • $expiration (int) : The expiration time.
    • $user_id (int) : The user ID.
    • $scheme (string) : The scheme.
    • $token (string) : The token.
  • Arguments
    • $auth_cookie: The authentication cookie.
    • $expire: The expiration time.
    • $expiration: The expiration time.
    • $user_id: The user ID.
    • $scheme: The scheme.
    • $token: The token.
  • Usage
    • This action allows you to execute custom functionality when the authentication cookie is set.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the cookie setting process.

function custom_set_auth_cookie_callback($auth_cookie, $expire, $expiration, $user_id, $scheme, $token) {
    // Your custom functionality here
    error_log('Authentication cookie set for user ' . $user_id);
}
add_action('set_auth_cookie', 'custom_set_auth_cookie_callback', 10, 6);

Action: set_logged_in_cookie #

  • Data Type
    • $logged_in_cookie (string) : The logged-in cookie.
    • $expire (int) : The expiration time.
    • $expiration (int) : The expiration time.
    • $user_id (int) : The user ID.
    • ‘logged_in’ (string) : The logged-in scheme.
    • $token (string) : The token.
  • Arguments
    • $logged_in_cookie: The logged-in cookie.
    • $expire: The expiration time.
    • $expiration: The expiration time.
    • $user_id: The user ID.
    • logged_in’: The logged-in scheme.
    • $token: The token.
  • Usage
    • This action allows you to execute custom functionality when the logged-in cookie is set.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the cookie setting process.

function custom_set_logged_in_cookie_callback($logged_in_cookie, $expire, $expiration, $user_id, $token) {
    // Your custom functionality here
    error_log('Logged-in cookie set for user ' . $user_id);
}
add_action('set_logged_in_cookie', 'custom_set_logged_in_cookie_callback', 10, 6);

Action: switch_to_user #

  • Data Type
    • $user_id (int) : The user ID to switch to.
    • $old_user_id (int) : The old user ID.
    • $new_token (string) : The new token.
    • $old_token (string) : The old token.
  • Arguments
    • $user_id: The user ID to switch to.
    • $old_user_id: The old user ID.
    • $new_token: The new token.
    • $old_token: The old token.
  • Usage
    • This action allows you to execute custom functionality when switching to a user.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the user switching process.

function custom_switch_to_user_callback($user_id, $old_user_id, $new_token, $old_token) {
    // Your custom functionality here
    error_log('Switched to user ' . $user_id . ' from user ' . $old_user_id);
}
add_action('switch_to_user', 'custom_switch_to_user_callback', 10, 4);

Action: switch_back_user #

  • Data Type
    • $user_id (int) : The user ID to switch back to.
    • $old_user_id (int) : The old user ID.
    • $new_token (string) : The new token.
    • $old_token (string) : The old token.
  • Arguments
    • $user_id: The user ID to switch back to.
    • $old_user_id: The old user ID.
    • $new_token: The new token.
    • $old_token: The old token.
  • Usage
    • This action allows you to execute custom functionality when switching back to a user.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the user switching process.

function custom_switch_back_user_callback($user_id, $old_user_id, $new_token, $old_token) {
    // Your custom functionality here
    error_log('Switched back to user ' . $user_id . ' from user ' . $old_user_id);
}
add_action('switch_back_user', 'custom_switch_back_user_callback', 10, 4);

Action: switch_off_user #

  • Data Type
    • $old_user_id (int) : The old user ID.
    • $old_token (string) : The old token.
  • Arguments
    • $old_user_id: The old user ID.
    • $old_token: The old token.
  • Usage
    • This action allows you to execute custom functionality when switching off a user.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the user switching off process.

function custom_switch_off_user_callback($old_user_id, $old_token) {
    // Your custom functionality here
    error_log('Switched off user ' . $old_user_id);
}
add_action('switch_off_user', 'custom_switch_off_user_callback', 10, 2);

Action: safw_email_assign_agent #

  • Data Type
    • $assign_user (int) : The assigned user ID.
    • $post_id (int) : The post ID.
  • Arguments
    • $assign_user: The assigned user ID.
    • $post_id: The post ID.
  • Usage
    • This action allows you to execute custom functionality when an agent is assigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_agent_callback($assign_user, $post_id) {
    // Your custom functionality here
    error_log('Agent ' . $assign_user . ' assigned via email to post ' . $post_id);
}
add_action('safw_email_assign_agent', 'custom_safw_email_assign_agent_callback', 10, 2);

Action: woocommerce_save_account_details #

  • Data Type
    • $customer_id (int) : The customer ID.
  • Arguments
    • $customer_id: The customer ID.
  • Usage
    • This action allows you to execute custom functionality when WooCommerce account details are saved.

You can use this action to perform tasks such as updating records, sending notifications, or modifying the save process.

function custom_woocommerce_save_account_details_callback($customer_id) {
    // Your custom functionality here
    error_log('WooCommerce account details saved for customer ' . $customer_id);
}
add_action('woocommerce_save_account_details', 'custom_woocommerce_save_account_details_callback', 10);

Action: before_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the dashboard data for the month is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the monthly dashboard data is shown.

function custom_before_dashbord_data_monthly_callback() {
    // Your custom functionality here
    error_log('Before dashboard data monthly');
}
add_action('before_dashbord_data_monthly', 'custom_before_dashbord_data_monthly_callback');

Action: after_dashbord_data_monthly #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the dashboard data for the month is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the monthly dashboard data is shown.

function custom_after_dashbord_data_monthly_callback() {
    // Your custom functionality here
    error_log('After dashboard data monthly');
}
add_action('after_dashbord_data_monthly', 'custom_after_dashbord_data_monthly_callback');

Action: safw_email_assign_sales_manager_role #

  • Data Type
    • $post (object) : The post object.
  • Arguments
    • $post: The post object.
  • Usage
    • This action allows you to execute custom functionality when a sales manager role is assigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_sales_manager_role_callback($post) {
    // Your custom functionality here
    error_log('Sales manager role assigned via email for post ID ' . $post->ID);
}
add_action('safw_email_assign_sales_manager_role', 'custom_safw_email_assign_sales_manager_role_callback', 10);

Action: safw_email_unassign_sales_manager_role #

  • Data Type
    • $post (object) : The post object.
  • Arguments
    • $post: The post object.
  • Usage
    • This action allows you to execute custom functionality when a sales manager role is unassigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the unassignment process.

function custom_safw_email_unassign_sales_manager_role_callback($post) {
    // Your custom functionality here
    error_log('Sales manager role unassigned via email for post ID ' . $post->ID);
}
add_action('safw_email_unassign_sales_manager_role', 'custom_safw_email_unassign_sales_manager_role_callback', 10);

Action: safw_email_unassign_sales_subagent_role #

  • Data Type
    • $post (object) : The post object.
    • $deleted_agents (array) : The list of deleted agents.
  • Arguments
    • $post: The post object.
    • $deleted_agents: The list of deleted agents.
  • Usage
    • This action allows you to execute custom functionality when a sales subagent role is unassigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the unassignment process.

function custom_safw_email_unassign_sales_subagent_role_callback($post, $deleted_agents) {
    // Your custom functionality here
    error_log('Sales subagent role unassigned via email for post ID ' . $post->ID . ' with deleted agents: ' . implode(', ', $deleted_agents));
}
add_action('safw_email_unassign_sales_subagent_role', 'custom_safw_email_unassign_sales_subagent_role_callback', 10, 2);

Action: safw_email_assign_manager_to_subagent #

  • Data Type
    • $post (object) : The post object.
  • Arguments
    • $post: The post object.
  • Usage
    • This action allows you to execute custom functionality when a manager is assigned to a subagent via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_manager_to_subagent_callback($post) {
    // Your custom functionality here
    error_log('Manager assigned to subagent via email for post ID ' . $post->ID);
}
add_action('safw_email_assign_manager_to_subagent', 'custom_safw_email_assign_manager_to_subagent_callback', 10);

Action: safw_email_assign_subagent_to_manager #

  • Data Type
    • $post (object) : The post object.
  • Arguments
    • $post: The post object.
  • Usage
    • This action allows you to execute custom functionality when a subagent is assigned to a manager via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_subagent_to_manager_callback($post) {
    // Your custom functionality here
    error_log('Subagent assigned to manager via email for post ID ' . $post->ID);
}
add_action('safw_email_assign_subagent_to_manager', 'custom_safw_email_assign_subagent_to_manager_callback', 10);

Action: safw_email_assign_comm_cat #

  • Data Type
    • $post_id (int) : The post ID.
    • $commission_category (string) : The commission category.
  • Arguments
    • $post_id: The post ID.
    • $commission_category: The commission category.
  • Usage
    • This action allows you to execute custom functionality when a commission category is assigned via email.

You can use this action to perform tasks such as sending notifications, updating records, or modifying the assignment process.

function custom_safw_email_assign_comm_cat_callback($post_id, $commission_category) {
    // Your custom functionality here
    error_log('Commission category ' . $commission_category . ' assigned to post ID ' . $post_id);
}
add_action('safw_email_assign_comm_cat', 'custom_safw_email_assign_comm_cat_callback', 10, 2);

Action: wc_agent_before_include_template #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before a template is included.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the template is included.

function custom_wc_agent_before_include_template_callback() {
    // Your custom functionality here
    error_log('Before include template');
}
add_action('wc_agent_before_include_template', 'custom_wc_agent_before_include_template_callback');

Action: wc_agent_after_include_template #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after a template is included.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the template is included.

function custom_wc_agent_after_include_template_callback() {
    // Your custom functionality here
    error_log('After include template');
}
add_action('wc_agent_after_include_template', 'custom_wc_agent_after_include_template_callback');

Action: wc_agent_payout_admin_order_details #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality in the payout admin order details.

You can use this action to perform tasks such as displaying additional information, updating records, or modifying the output in the admin order details.

function custom_wc_agent_payout_admin_order_details_callback() {
    // Your custom functionality here
    error_log('Payout admin order details');
}
add_action('wc_agent_payout_admin_order_details', 'custom_wc_agent_payout_admin_order_details_callback');

Action: before_front_end_filters_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end filters for agent customers are displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the filters are shown.

function custom_before_front_end_filters_agent_customers_callback() {
    // Your custom functionality here
    error_log('Before front-end filters for agent customers');
}
add_action('before_front_end_filters_agent_customers', 'custom_before_front_end_filters_agent_customers_callback');

Action: after_front_end_filters_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end filters for agent customers are displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the filters are shown.

function custom_after_front_end_filters_agent_customers_callback() {
    // Your custom functionality here
    error_log('After front-end filters for agent customers');
}
add_action('after_front_end_filters_agent_customers', 'custom_after_front_end_filters_agent_customers_callback');

Action: before_front_end_list_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end list of agent customers is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the list is shown

function custom_before_front_end_list_agent_customers_callback() {
    // Your custom functionality here
    error_log('Before front-end list of agent customers');
}
add_action('before_front_end_list_agent_customers', 'custom_before_front_end_list_agent_customers_callback');

Action: after_front_end_list_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end list of agent customers is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the list is shown.

function custom_after_front_end_list_agent_customers_callback() {
    // Your custom functionality here
    error_log('After front-end list of agent customers');
}
add_action('after_front_end_list_agent_customers', 'custom_after_front_end_list_agent_customers_callback');

before_front_end_pagentation_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end pagination for agent customers is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the pagination is shown.

function custom_before_front_end_pagentation_agent_customers_callback() {
    // Your custom functionality here
    error_log('Before front-end pagination for agent customers');
}
add_action('before_front_end_pagentation_agent_customers', 'custom_before_front_end_pagentation_agent_customers_callback');

Action: after_front_end_pagentation_agent_customers #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end pagination for agent customers is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the pagination is shown.

function custom_after_front_end_pagentation_agent_customers_callback() {
    // Your custom functionality here
    error_log('After front-end pagination for agent customers');
}
add_action('after_front_end_pagentation_agent_customers', 'custom_after_front_end_pagentation_agent_customers_callback');

Action: before_front_end_filters_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end filters for agent commissions are displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the filters are shown.

function custom_before_front_end_filters_agent_commissions_callback() {
    // Your custom functionality here
    error_log('Before front-end filters for agent commissions');
}
add_action('before_front_end_filters_agent_commissions', 'custom_before_front_end_filters_agent_commissions_callback');

Action: after_front_end_filters_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end filters for agent commissions are displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the filters are shown.

function custom_after_front_end_filters_agent_commissions_callback() {
    // Your custom functionality here
    error_log('After front-end filters for agent commissions');
}
add_action('after_front_end_filters_agent_commissions', 'custom_after_front_end_filters_agent_commissions_callback');

Action: before_front_end_list_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end list of agent commissions is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the list is shown.

function custom_before_front_end_list_agent_commissions_callback() {
    // Your custom functionality here
    error_log('Before front-end list of agent commissions');
}
add_action('before_front_end_list_agent_commissions', 'custom_before_front_end_list_agent_commissions_callback');

Action: after_front_end_list_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end list of agent commissions is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the list is shown.

function custom_after_front_end_list_agent_commissions_callback() {
    // Your custom functionality here
    error_log('After front-end list of agent commissions');
}
add_action('after_front_end_list_agent_commissions', 'custom_after_front_end_list_agent_commissions_callback');

Action: before_front_end_pagentation_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the front-end pagination for agent commissions is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the pagination is shown.

function custom_before_front_end_pagentation_agent_commissions_callback() {
    // Your custom functionality here
    error_log('Before front-end pagination for agent commissions');
}
add_action('before_front_end_pagentation_agent_commissions', 'custom_before_front_end_pagentation_agent_commissions_callback');

Action: after_front_end_pagentation_agent_commissions #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the front-end pagination for agent commissions is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the pagination is shown.

function custom_after_front_end_pagentation_agent_commissions_callback() {
    // Your custom functionality here
    error_log('After front-end pagination for agent commissions');
}
add_action('after_front_end_pagentation_agent_commissions', 'custom_after_front_end_pagentation_agent_commissions_callback');

Action: wc_view_customer_details #

  • Data Type
    • $customer_id (int) : The customer ID.
  • Arguments
    • $customer_id: The customer ID.
  • Usage
    • This action allows you to execute custom functionality when viewing customer details.

You can use this action to perform tasks such as displaying additional information, updating records, or modifying the output.

function custom_wc_view_customer_details_callback($customer_id) {
    // Your custom functionality here
    error_log('Viewing customer details for customer ID ' . $customer_id);
}
add_action('wc_view_customer_details', 'custom_wc_view_customer_details_callback', 10);

Action: wc_before_edit_customer_form #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the edit customer form is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the form is shown.

function custom_wc_before_edit_customer_form_callback() {
    // Your custom functionality here
    error_log('Before edit customer form');
}
add_action('wc_before_edit_customer_form', 'custom_wc_before_edit_customer_form_callback');

a href=”Action: wc_before_edit_customer_form_tag”>Action: wc_before_edit_customer_form_tag #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the edit customer form tag is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the form tag is shown.

function custom_wc_before_edit_customer_form_tag_callback() {
    // Your custom functionality here
    error_log('Before edit customer form tag');
}
add_action('wc_before_edit_customer_form_tag', 'custom_wc_before_edit_customer_form_tag_callback');

a href=”Action: wc_before_edit_customer_form_tag”>Action: wc_before_edit_customer_form_start #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the start of the edit customer form.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the form start is shown.

function custom_wc_before_edit_customer_form_start_callback() {
    // Your custom functionality here
    error_log('Before start of edit customer form');
}
add_action('wc_before_edit_customer_form_start', 'custom_wc_before_edit_customer_form_start_callback');

a href=”Action: wc_before_edit_customer_form_tag”>Action: wc_edit_customer_form #

  • Data Type
    • $user_id (int) : The user ID.
  • Arguments
    • $user_id: The user ID.
  • Usage
    • This action allows you to execute custom functionality during the edit customer form.

You can use this action to perform tasks such as displaying additional information, updating records, or modifying the output during the form display.

function custom_wc_edit_customer_form_callback($user_id) {
    // Your custom functionality here
    error_log('Editing customer form for user ID ' . $user_id);
}
add_action('wc_edit_customer_form', 'custom_wc_edit_customer_form_callback', 10, 1);

a href=”Action: wc_before_edit_customer_form_tag”>Action: wc_edit_customer_form_end #

  • Data Type
    • $user_id (int) : The user ID.
  • Arguments
    • $user_id: The user ID.
  • Usage
    • This action allows you to execute custom functionality at the end of the edit customer form.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output at the end of the form display.

function custom_wc_edit_customer_form_end_callback($user_id) {
    // Your custom functionality here
    error_log('End of edit customer form for user ID ' . $user_id);
}
add_action('wc_edit_customer_form_end', 'custom_wc_edit_customer_form_end_callback', 10, 1);

Action: wc_after_edit_customer_form #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality after the edit customer form is displayed.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the form is shown.

function custom_wc_after_edit_customer_form_callback() {
    // Your custom functionality here
    error_log('After edit customer form');
}
add_action('wc_after_edit_customer_form', 'custom_wc_after_edit_customer_form_callback');

Action: wc_agent_before_customer_orders #

  • Data Type
    • $has_orders (bool) : Whether the customer has orders.
  • Arguments
    • $has_orders: Whether the customer has orders.
  • Usage
    • This action allows you to execute custom functionality before displaying customer orders.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the customer orders are displayed.

function custom_wc_agent_before_customer_orders_callback($has_orders) {
    // Your custom functionality here
    error_log('Before displaying customer orders: ' . ($has_orders ? 'Has orders' : 'No orders'));
}
add_action('wc_agent_before_customer_orders', 'custom_wc_agent_before_customer_orders_callback', 10, 1);

Action: woocommerce_my_account_my_orders_column_ #

  • Data Type
    • $column_id (string) : The column ID.
    • $orders (array) : Array of customer orders.
  • Arguments
    • $column_id: The column ID.
    • $orders: Array of customer orders.
  • Usage
    • This action allows you to execute custom functionality for each column in the My Account orders table.

You can use this action to perform tasks such as displaying additional information, updating records, or modifying the output for each column in the orders table.

function custom_woocommerce_my_account_my_orders_column_callback($column_id, $orders) {
    // Your custom functionality here
    error_log('My Account orders column: ' . $column_id);
}
add_action('woocommerce_my_account_my_orders_column_', 'custom_woocommerce_my_account_my_orders_column_callback', 10, 2);

Action: wc_agent_before_customer_orders_pagination #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality before the pagination for customer orders is displayed.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output before the pagination is shown.

function custom_wc_agent_before_customer_orders_pagination_callback() {
    // Your custom functionality here
    error_log('Before pagination for customer orders');
}
add_action('wc_agent_before_customer_orders_pagination', 'custom_wc_agent_before_customer_orders_pagination_callback');

Action: wc_agent_after_customer_orders #

  • Data Type
    • $has_orders (bool) : Whether the customer has orders.
  • Arguments
    • $has_orders: Whether the customer has orders.
  • Usage
    • This action allows you to execute custom functionality after displaying customer orders.

You can use this action to perform tasks such as cleaning up, finalizing components, or modifying the output after the customer orders are displayed.

function custom_wc_agent_after_customer_orders_callback($has_orders) {
    // Your custom functionality here
    error_log('After displaying customer orders: ' . ($has_orders ? 'Has orders' : 'No orders'));
}
add_action('wc_agent_after_customer_orders', 'custom_wc_agent_after_customer_orders_callback', 10, 1);

Action: sales_agent_order_init #

  • Data Type
    • None
  • Arguments
    • None
  • Usage
    • This action allows you to execute custom functionality during the initialization of a sales agent order.

You can use this action to perform tasks such as preparing data, initializing components, or modifying the output during the order initialization.

function custom_sales_agent_order_init_callback() {
    // Your custom functionality here
    error_log('Sales agent order initialized');
}
add_action('sales_agent_order_init', 'custom_sales_agent_order_init_callback');

Filters: #

Filter: sales_agent_subagent_search_args #

  • Data Type
    • Array: $args – The query arguments to be modified.
  • Arguments
    • (Array): $args – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, meta query, etc.
/**
 * Modify the query arguments for sales agent subagent search.
 *
 * @param array $args The query arguments.
 * @return array Modified query arguments.
*/
function custom_modify_sales_agent_subagent_search_args($args) {
    // Example: Change post type to 'custom_agent'
    $args['post_type'] = 'custom_agent';
    return $args;
}
add_filter('sales_agent_subagent_search_args', 'custom_modify_sales_agent_subagent_search_args', 10, 1);

Filter: sales_agent_group_search_args #

  • Arguments
    • (Array): $args – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, excluded posts, etc.
/**
 * Modify the query arguments for sales agent group search.
 *
 * @param array $args The query arguments.
 * @return array Modified query arguments.
 */
function custom_modify_sales_agent_group_search_args($args) {
    // Example: Change post type to 'custom_agent'
    $args['post_type'] = 'custom_agent';
    return $args;
}
add_filter('sales_agent_group_search_args', 'custom_modify_sales_agent_group_search_args', 10, 1);

Filter: sales_agent_agent_customer_search_args #

  • Data Type
    • Array: $arg – The query arguments to be modified.
  • Arguments
    • (Array): $arg – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, excluded posts, etc.
/**
 * Modify the query arguments for sales agent agent customer search.
 *
 * @param array $arg The query arguments.
 * @return array Modified query arguments.
 */
function custom_modify_sales_agent_agent_customer_search_args($arg) {
    // Example: Change post type to 'custom_agent'
    $arg['post_type'] = 'custom_agent';
    return $arg;
}
add_filter('sales_agent_agent_customer_search_args', 'custom_modify_sales_agent_agent_customer_search_args', 10, 1);

Filter: sales_agent_user_search_args #

  • Data Type
    • Array: $arg – The query arguments to be modified.
  • Arguments
    • (Array): $arg – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, excluded posts, etc.
 * Modify the query arguments for sales agent user search.
 *
 * @param array $arg The query arguments.
 * @return array Modified query arguments.
 */
function custom_modify_sales_agent_user_search_args($arg) {
    // Example: Change post type to 'custom_agent'
    $arg['post_type'] = 'custom_agent';
    return $arg;
}
add_filter('sales_agent_user_search_args', 'custom_modify_sales_agent_user_search_args', 10, 1);

Filter: before_customer_orders_amount #

  • Data Type
    • Array: $arg – The query arguments to be modified.
  • Arguments
    • (Array): $arg – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, meta query, etc.
/**
 * Modify the query arguments before getting customer orders amount.
 *
 * @param array $args The query arguments.
 * @return array Modified query arguments.
 */
function custom_before_customer_orders_amount($args) {
    // Example: Change post type to 'custom_agent'
    $args['post_type'] = 'custom_agent';
   return $args;
}
add_filter('before_customer_orders_amount', 'custom_before_customer_orders_amount', 10, 1);

Filter: before_customer_orders_amount #

  • Data Type
    • Array: $data – The data to be modified.
  • Arguments
    • (Array): $data – The data to be modified.
  • Usage
    • This filter allows you to modify the data after the customer orders amount is retrieved.
    • You can use this filter to adjust any aspect of the data, such as formatting, additional calculations, etc.
/**
 * Modify the data after getting customer orders amount.
 *
 * @param array $data The data.
 * @return array Modified data.
 */
function custom_after_customer_orders_amount($data) {
    // Example: Add a custom field to the data
    $data['custom_field'] = 'custom_value';
    return $data;
}
add_filter('after_customer_orders_amount', 'custom_after_customer_orders_amount', 10, 1);

Filter: list_customers_agent_args #

  • Data Type
    • Array: $args – The query arguments to be modified.
  • Arguments
    • (Array): $args – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, meta query, etc.
/**
 * Modify the query arguments for listing customers agents.
 *
 * @param array $args The query arguments.
 * @return array Modified query arguments.
 */
function custom_list_customers_agent_args($args) {
    // Example: Change post type to 'custom_agent'
    $args['post_type'] = 'custom_agent';
    return $args;
}
add_filter('list_customers_agent_args', 'custom_list_customers_agent_args', 10, 1);

Filter: after_get_customers_agent #

  • Data Type
    • Array: $data – The data to be modified.
  • Arguments
    • (Array): $data – The data to be modified.
  • Usage
    • This filter allows you to modify the data after the customers agent is retrieved.
    • You can use this filter to adjust any aspect of the data, such as formatting, additional calculations, etc.
/**
 * Modify the data after getting customers agent.
 *
 * @param array $data The data.
 * @return array Modified data.
 */
function custom_after_get_customers_agent($data) {
    // Example: Add a custom field to the data
    $data['custom_field'] = 'custom_value';
    return $data;
}
add_filter('after_get_customers_agent', 'custom_after_get_customers_agent', 10, 1);

Filter: wc_agent_before_agent_orders #

  • Data Type
    • Array: $args – The query arguments to be modified.
  • Arguments
    • (Array): $args – The query arguments to be modified.
  • Usage
    • This filter allows you to modify the query arguments before the WP_Query is executed.
    • You can use this filter to adjust any aspect of the query, such as post type, post status, meta query, etc.
/**
 * Modify the query arguments before getting agent orders.
 *
 * @param array $args The query arguments.
 * @return array Modified query arguments.
 */
function custom_wc_agent_before_agent_orders($args) {
    // Example: Change post type to 'custom_agent'
    $args['post_type'] = 'custom_agent';
    return $args;
}
add_filter('wc_agent_before_agent_orders', 'custom_wc_agent_before_agent_orders', 10, 1);

10. Filter: wc_agent_after_agent_orders #

  • Data Type
    • Array: $result – The result to be modified.
  • Arguments
    • (Array): $result – The result to be modified.
  • Usage
    • This filter allows you to modify the result after the agent orders are retrieved.
    • You can use this filter to adjust any aspect of the result, such as formatting, additional calculations, etc.
/**
 * Modify the result after getting agent orders.
 *
 * @param array $result The result.
 * @return array Modified result.
 */
function custom_wc_agent_after_agent_orders($result) {
    // Example: Add a custom field to the result
    $result['custom_field'] = 'custom_value';
    return $result;
}
add_filter('wc_agent_after_agent_orders', 'custom_wc_agent_after_agent_orders', 10, 1);

Filter: wc_agent_menu_position #

  • Data Type
    • Integer: $position – The position of the menu item.
  • Arguments
    • (Integer): $position – The position of the menu item in the admin dashboard.
  • Usage
    • This filter allows you to modify the position of the “Agent Groups” menu item in the WordPress admin dashboard. You can use this filter to adjust where the menu item appears in the admin menu.
function custom_wc_agent_menu_position($position) {
    // Example: Change the menu position to 15
    return 15;
}
add_filter('wc_agent_menu_position', 'custom_wc_agent_menu_position', 10, 1);

Filter: after_get_commissions_list_data #

  • Data Type
    • Array: $rows – The list of commissions data.
  • Arguments
    • (Array): $rows – The list of commissions data.
  • Usage
    • This filter allows you to modify the list of commissions data after it has been retrieved. You can use this filter to adjust or extend the data before it is returned.
```php
function custom_after_get_commissions_list_data($rows) {
    // Example: Add a custom field to each commission row
    foreach ($rows as &$row) {
        $row['custom_field'] = 'Custom Value';
    }
    return $rows;
}
add_filter('after_get_commissions_list_data', 'custom_after_get_commissions_list_data', 10, 1);

Filter: after_get_sub_commissions_list_data #

  • Data Type
    • Array: $rows – The list of sub-commissions data.
  • Arguments
    • (Array): $rows – The list of sub-commissions data.
  • Usage
    • This filter allows you to modify the list of sub-commissions data after it has been retrieved. You can use this filter to adjust or extend the data before it is returned.
function custom_after_get_sub_commissions_list_data($rows) {
    // Example: Add a custom field to each sub-commission row
    foreach ($rows as &$row) {
        $row['custom_sub_field'] = 'Custom Sub Value';
    }
    return $rows;
}
add_filter('after_get_sub_commissions_list_data', 'custom_after_get_sub_commissions_list_data', 10, 1);

Filter: wc_agent_get_agent_commission #

  • Data Type
    • Mixed: $commission – The commission amount or data.
    • Int: $agent_id – The ID of the agent.
  • Arguments
    • (Mixed): $commission – The commission amount or data.
    • (Int): $agent_id – The ID of the agent.
  • Usage
    • This filter allows you to modify the commission data for a specific agent before it is returned. You can use this filter to adjust or extend the commission information.
function custom_wc_agent_get_agent_commission($commission, $agent_id) {
    // Example: Increase the commission by 10%
    $commission = $commission * 1.10;
    return $commission;
}
add_filter('wc_agent_get_agent_commission', 'custom_wc_agent_get_agent_commission', 10, 2);

Filter: wc_agent_get_agent_commission_by_group #

  • Data Type
    • Mixed: $commission – The commission amount or data.
  • Arguments
    • (Mixed): $commission – The commission amount or data.
  • Usage
    • This filter allows you to modify the commission data for a group of agents before it is returned. You can use this filter to adjust or extend the commission information for agent groups.
```php
function custom_wc_agent_get_agent_commission_by_group($commission) {
    // Example: Increase the commission by 15%
    $commission = $commission * 1.15;
    return $commission;
}
add_filter('wc_agent_get_agent_commission_by_group', 'custom_wc_agent_get_agent_commission_by_group', 10, 1);

Filter: safw_admin_order_comm_list_date #

  • Data Type
    • String: $create_date – The order creation date.
    • Object: $item – The order item object.
  • Arguments
    • (String): $create_date – The order creation date.
    • (Object): $item – The order item object.
  • Usage
    • This filter allows you to modify the order creation date displayed in the admin order commission list.
```php
function custom_safw_admin_order_comm_list_date($create_date, $item) {
    // Example: Format the date differently
    return date_i18n('Y-m-d', strtotime($create_date));
}
add_filter('safw_admin_order_comm_list_date', 'custom_safw_admin_order_comm_list_date', 10, 2);

Filter: safw_admin_comm_list_order_date_heading #

  • Data Type
    • String: $default_heading – The default heading for the order date column.
  • Arguments
    • (String): $default_heading – The default heading for the order date column.
  • Usage
    • This filter allows you to modify the heading label for the order date column in the admin commission list.
```php
function custom_safw_admin_comm_list_order_date_heading($default_heading) {
    // Example: Change the heading label
    return __('Date of Order', 'sales-agent');
}
add_filter('safw_admin_comm_list_order_date_heading', 'custom_safw_admin_comm_list_order_date_heading', 10, 1);

Filter: safw_admin_query_commission_list_count #

  • Data Type
    • Integer: $total_items – The total number of items calculated.
    • Boolean: $customer_date_flag – Flag indicating if filtering by customer date is active.
    • Boolean: $only_date_flag – Flag indicating if only date filtering is active.
  • Arguments
    • (Integer): $total_items – The total number of items calculated.
    • (Boolean): $customer_date_flag – Flag indicating if filtering by customer date is active.
    • (Boolean): $only_date_flag – Flag indicating if only date filtering is active.
  • Usage
    • This filter allows you to modify or calculate the total number of items shown in the admin commission list.
```php
function custom_safw_admin_query_commission_list_count($total_items, $customer_date_flag, $only_date_flag) {
    // Example: Increase the total items count by 10
    $total_items += 10;
    return $total_items;
}
add_filter('safw_admin_query_commission_list_count', 'custom_safw_admin_query_commission_list_count', 10, 3);

Filter: safw_admin_query_sub_commission_list_count #

  • Data Type
    • Integer: $total_items – The total number of items calculated.
  • Arguments
    • (Integer): $total_items – The total number of items calculated.
  • Usage
    • This filter allows you to modify or calculate the total number of items shown in the admin sub-commission list.
```php
function custom_safw_admin_query_sub_commission_list_count($total_items) {
    // Example: Increase the total items count by 10
    $total_items += 10;
    return $total_items;
}
add_filter('safw_admin_query_sub_commission_list_count', 'custom_safw_admin_query_sub_commission_list_count', 10, 1);

Filter: args_cutomer_details_orders #

  • Data Type
    • Array: $args – Arguments for querying customer details orders.
  • Arguments
    • (Array): $args – Arguments for querying customer details orders.
  • Usage
    • This filter allows you to modify the arguments used to query customer details orders. You can adjust parameters such as customer ID, limit, offset, meta query, and ordering.
```php
function custom_args_cutomer_details_orders($args) {
    // Example: Adjust the limit and offset
    $args['limit'] = 20; // Set limit to 20
    $args['offset'] = 0; // Reset offset to 0
    return $args;
}
add_filter('args_cutomer_details_orders', 'custom_args_cutomer_details_orders', 10, 1);

Filter: get_cutomer_details_orders #

  • Data Type
    • Array: $data – Array containing customer order details and count.
  • Arguments
    • (Array): $data – Array containing customer order details and count.
  • Usage
    • This filter allows you to modify the array of customer order details and count before returning it. You can adjust the order details such as order ID, date, status, payment method, total, and agent associated with each order.
```php
function custom_get_cutomer_details_orders($data) {
    // Example: Modify order details
    foreach ($data['data'] as &$order) {
        $order['order_total'] = $order['order_total'] * 2; // Double the order total
    }
    return $data;
}
add_filter('get_cutomer_details_orders', 'custom_get_cutomer_details_orders', 10, 1);

Filter: wc_agent_menu_position #

  • Data Type
    • Integer: $menu_position – The menu position for the Sales Agent menu.
  • Arguments
    • (Integer): $menu_position – The default menu position.
  • Usage
    • This filter allows you to modify the menu position of the Sales Agent menu in the WordPress admin dashboard.
```php
add_filter('wc_agent_menu_position', 'custom_wc_agent_menu_position', 10, 1);
function custom_wc_agent_menu_position($menu_position) {
    // Example: Change menu position to 55
    return 55;
}

Filter: wc_agents_dashboard_title #

  • Data Type
    • String: $dashboard_title – The dashboard title for the Sales Agent.
  • Arguments
    • (String): $dashboard_title – The default dashboard title.
  • Usage
    • This filter allows you to modify the dashboard title displayed for the Sales Agent.
```php
add_filter('wc_agents_dashboard_title', 'custom_wc_agents_dashboard_title');
function custom_wc_agents_dashboard_title($dashboard_title) {
    // Example: Modify the dashboard title
    return __('My Custom Dashboard', 'sales-agent');
}

Filter: data_count_customer_montly #

  • Data Type
    • Integer: $data – The total count of customers.
  • Arguments
    • (Integer): $data – The total count of customers.
  • Usage
    • This filter allows you to modify the total count of customers before it is returned. You can use this filter to adjust or manipulate the count as needed.
```php
add_filter('data_count_customer_montly', 'custom_data_count_customer_montly');
function custom_data_count_customer_montly($data) {
    // Example: Increase the count by 100
    return $data + 100;
}

Filter: data_count_agent_montly #

  • Data Type
    • Integer: $data – The total count of agents.
  • Arguments
    • (Integer): $data – The total count of agents.
  • Usage
    • This filter allows you to modify the total count of agents before it is returned. You can use this filter to adjust or manipulate the count as needed.
```php
add_filter('data_count_agent_montly', 'custom_data_count_agent_montly');
function custom_data_count_agent_montly($data) {
    // Example: Increase the count by 50
    return $data + 50;
}

Filter: data_count_order_montly #

  • Data Type
    • Integer: $data – The total count of orders.
  • Arguments
    • (Integer): $data – The total count of orders.
  • Usage
    • This filter allows you to modify the total count of orders before it is returned. You can use this filter to adjust or manipulate the count as needed.
```php
add_filter('data_count_order_montly', 'custom_data_count_order_montly');
function custom_data_count_order_montly($data) {
    // Example: Double the count
    return $data * 2;
}

Filter: statuses_of_order_by_agent #

  • Data Type
    • String: $statuses – The comma-separated list of order statuses.
  • Arguments
    • (String): $statuses – The comma-separated list of order statuses.
  • Usage
    • This filter allows you to modify the list of order statuses used to filter orders by agent in a SQL query.
```php
add_filter('statuses_of_order_by_agent', 'custom_statuses_of_order_by_agent');
function custom_statuses_of_order_by_agent($statuses) {
    // Example: Add 'wc-on-hold' status
    $statuses .= ', "wc-on-hold"';
    return $statuses;
}

Filter: data_total_count_order_by_agent #

  • Data Type
    • Integer: $data – The total count of orders.
  • Arguments
    • (Integer): $data – The total count of orders.
  • Usage
    • This filter allows you to modify the total count of orders retrieved by agent before it is returned.
```php
add_filter('data_total_count_order_by_agent', 'custom_data_total_count_order_by_agent');
function custom_data_total_count_order_by_agent($data) {
    // Example: Adjust the total count by adding 10
    $data += 10;
    return $data;
}

Filter: data_count_paid_commission #

  • Data Type
    • Integer: $data – The count of paid commissions.
  • Arguments
    • (Integer): $data – The count of paid commissions.
  • Usage
    • This filter allows you to modify the count of paid commissions before it is returned.
```php
add_filter('data_count_paid_commission', 'custom_data_count_paid_commission');
function custom_data_count_paid_commission($data) {
    // Example: Adjust the count by adding 5
    $data += 5;
    return $data;
}

Filter: data_count_pending_commission #

  • Data Type
    • Integer: $data – The count of pending commissions.
  • Arguments
    • (Integer): $data – The count of pending commissions.
  • Usage
    • This filter allows you to modify the count of pending commissions before it is returned.
```php
add_filter('data_count_pending_commission', 'custom_data_count_pending_commission');
function custom_data_count_pending_commission($data) {
    // Example: Adjust the count by subtracting 2
    $data -= 2;
    return $data;
}

Filter: data_total_value_order_montly #

  • Data Type
    • Integer or Float: $data – The total value of orders monthly.
  • Arguments
    • (Integer or Float): $data – The total value of orders monthly.
  • Usage
    • This filter allows you to modify the total value of orders monthly before it is returned.
```php
add_filter('data_total_value_order_montly', 'custom_data_total_value_order_montly');
function custom_data_total_value_order_montly($data) {
    // Example: Increase the total value by 10%
    $data *= 1.1;
    return $data;
}

Filter: wc_salesagent_change_csv_name #

  • Data Type
    • String: $site_name – The name of the site for CSV export.
  • Arguments
    • (String): $site_name – The name of the site for CSV export.
  • Usage
    • This filter allows you to modify the site name used for CSV export.
```php
add_filter('wc_salesagent_change_csv_name', 'custom_wc_salesagent_change_csv_name');
function custom_wc_salesagent_change_csv_name($site_name) {
    // Example: Append 'Export' to the site name
    $site_name .= '_Export';
    return $site_name;
}

Filter: admin_dashboard_orders_download_csv_header_name #

  • Data Type
    • Array: $heading – Array of column headers for the CSV export.
  • Arguments
    • (Array): $heading – Array of column headers for the CSV export.
  • Usage
    • This filter allows you to modify the column headers for the CSV export of orders in the admin dashboard.
```php
add_filter('admin_dashboard_orders_download_csv_header_name', 'custom_admin_dashboard_orders_csv_headers');
function custom_admin_dashboard_orders_csv_headers($heading) {
    // Example: Modify or add additional headers
    $heading[] = esc_html__('New Header', 'sales-agent');
    return $heading;
}

Filter: wc_sales_agent_admin_order_item_headers #

  • Data Type
    • String: $order_items_columns – HTML string containing table headers for order items.
    • WP_Post Object: $order – The WP_Post object representing the order.
  • Arguments
    • (String): $order_items_columns – HTML string containing table headers for order items.
    • (WP_Post): $order – The WP_Post object representing the order.
  • Usage
    • This filter allows you to modify the HTML table headers for order items in the sales agent admin area.
add_filter('wc_sales_agent_admin_order_item_headers', 'custom_sales_agent_order_item_headers', 10, 2);
function custom_sales_agent_order_item_headers($order_items_columns, $order) {
    // Modify or add additional table headers
    $order_items_columns .= '<th class="item_custom_field sortable" data-sort="string">' . esc_html__('Custom Field', 'sales-agent') . '</th>';
    return $order_items_columns;
}

Filter: wc_sales_agent_admin_order_item_values #

  • Data Type
    • String: $order_items_values – HTML string containing values for order items table.
    • WC_Product: $product – The WC_Product object associated with the order item.
    • WC_Order_Item_Product: $item – The WC_Order_Item_Product object representing the order item.
    • Int: $item_id – The ID of the order item.
  • Arguments
    • (String): $order_items_values – HTML string containing values for order items table.
    • (WC_Product): $product – The WC_Product object associated with the order item.
    • (WC_Order_Item_Product): $item – The WC_Order_Item_Product object representing the order item.
    • (Int): $item_id – The ID of the order item
  • Usage
    • This filter allows you to modify the HTML table values for each order item in the sales agent admin area.
add_filter('wc_sales_agent_admin_order_item_values', 'custom_sales_agent_order_item_values', 10, 4);
function custom_sales_agent_order_item_values($order_items_values, $product, $item, $item_id) {
    // Modify or add additional table values for order items
    $order_items_values .= '<td class="item_custom_field">' . esc_html__('Custom Value', 'sales-agent') . '</td>';
    return $order_items_values;
}

Filter: wc_sales_agent_order_commission #

  • Data Type
    • String: $commission – The commission amount associated with the order.
    • Int: $order_id – The ID of the order.
  • Arguments
    • (String): $commission – The commission amount associated with the order.
    • (Int): $order_id – The ID of the order.
  • Usage
    • This filter allows you to modify or retrieve the commission amount associated with an order in the sales agent area.
  • Example Usage
add_filter( 'wc_sales_agent_order_commission', customize_sales_agent_order_commission', 10, 2 );
 
 function customize_sales_agent_order_commission( $commission, $order_id ) {
     // Modify or retrieve commission based on custom logic
     return $commission;
  }

Filter: wc_sales_agent_order_agent #

  • Data Type
    • String: $agent – The sales agent associated with the order.
    • Int: $order_id – The ID of the order.
  • Arguments
    • (String): $agent – The sales agent associated with the order.
    • (Int): $order_id – The ID of the order.
  • Usage
    • This filter allows you to modify or retrieve the sales agent associated with an order in the sales agent area.
  • Example Usage
add_filter( 'wc_sales_agent_order_agent', 'customize_sales_agent_order_agent', 10, 2 );
 
  function customize_sales_agent_order_agent( $agent, $order_id ) {
     // Modify or retrieve sales agent based on custom logic
      return $agent;
  }

Filter: exclude_products_from_commission #

  • Data Type
    • String: $agent – The sales agent associated with the order.
    • Int: $customer_id – The ID of the customer associated with the order.
    • Int: $agent_id – The ID of the sales agent associated with the order.
    • Array: $commission – Array containing commission details for the agent.
    • WC_Order: $order – The WC_Order object representing the order.
  • Arguments
    • (Boolean): $exclude – Whether to exclude certain products from commission calculation.
    • (Int): $customer_id – The ID of the customer associated with the order.
    • (Int): $agent_id – The ID of the sales agent associated with the order.
    • (Array): $commission – Array containing commission details for the agent.
    • (WC_Order): $order – The WC_Order object representing the order.
  • Usage
    • This filter allows you to exclude certain products from commission calculation based on custom logic.
  • Example Usage
add_filter( 'exclude_products_from_commission', 'customize_exclude_products_from_commission', 10, 5 );
 
  function customize_exclude_products_from_commission( $exclude, $customer_id, $agent_id, $commission, $order ) {
      // Implement custom logic to decide whether to exclude products from commission
      if ( /* your condition to exclude products *//* ) {
          $exclude = true;
      }
      return $exclude;
  }

Filter: sales_agent_add_custom_commission_field #

  • Data Type
    • Boolean: $flag – Whether to add a custom commission field.
  • Arguments
    • (Boolean): $flag – Current flag indicating whether to add a custom commission field.
  • Usage
    • This filter allows you to control whether to add a custom commission field in your application.
add_filter( 'sales_agent_add_custom_commission_field', 'customize_add_custom_commission_field' );

function customize_add_custom_commission_field( $flag ) {
    // Example logic: Check if certain conditions are met to determine whether to add the field.
    $current_user = wp_get_current_user();

    // Example: Add custom commission field only if the current user is an administrator.
    if ( in_array( 'administrator', (array) $current_user->roles ) ) {
        $flag = true; // Enable the custom commission field.
    }

    return $flag;
}

Filter: safw_target_start_date #

  • Data Type
    • Integer: $start_date – Timestamp of the start date for a target.
  • Arguments
    • (Integer): $start_date – Current start date timestamp.
  • Usage
    • This filter allows you to modify or set the start date for a target, based on specific requirements or conditions.
add_filter( 'safw_target_start_date', 'customize_target_start_date', 10, 1 );

function customize_target_start_date( $start_date ) {
    // Example: Set a custom start date for targets, 7 days before the current date.
    $custom_start_date = strtotime( '-7 days' );

    // Ensure the custom start date is within a reasonable range, like not before a certain year.
    $custom_start_date = max( $custom_start_date, strtotime( '2020-01-01' ) );

    return $custom_start_date;
}

Filter: exclude_products_ids_form_commission #

  • Data Type
    • Boolean: $exclude – Whether to exclude products from commission calculation.
    • Int: $order_products_id – ID of the current order’s products.
    • WC_Order_Item_Product: $item – The WC_Order_Item_Product object representing the order item.
  • Arguments
    • (Boolean): $exclude – Whether to exclude products from commission calculation.
    • (Int): $order_products_id – ID of the current order’s products.
    • (WC_Order_Item_Product): $item – The WC_Order_Item_Product object representing the order item.
  • Usage
    • This filter allows you to exclude specific products from commission calculation based on custom logic.
add_filter( 'exclude_products_ids_form_commission', 'custom_exclude_products_from_commission', 10, 3 );

function custom_exclude_products_from_commission( $exclude, $order_products_id, $item ) {
    // Example logic to exclude products from commission calculation based on certain conditions.
    
    // Example: Exclude products if their ID is within a specific range.
    if ( $item->get_product_id() >= 100 && $item->get_product_id() <= 200 ) {
        $exclude = true; // Exclude products within the range.
    } else {
        $exclude = false; // Include other products.
    }

    return $exclude;
}

Filter: wc_agent_request_labels #

  • Data Type
    • String: $wc_user_field_label – The label for the WooCommerce user field.
    • Array: $field – Array containing key and label of the field.
  • Arguments
    • (String): $wc_user_field_label – The label for the WooCommerce user field.
    • (Array): $field – Array containing key and label of the field.
  • Usage
    • This filter allows you to modify the label for a specific WooCommerce user field.
add_filter( 'wc_agent_request_labels', 'custom_wc_agent_request_labels', 10, 2 );

function custom_wc_agent_request_labels( $wc_user_field_label, $field ) {
    // Modify the label based on your specific logic
    // Example: Append a suffix to the label
    $modified_label = $wc_user_field_label . ' (Modified)';
    
    return $modified_label;
}

Filter: sc_agent_register_notices #

  • Data Type
    • Array: $messages – Array containing registration notices.
  • Arguments
    • (Array): $messages – Array containing registration notices.
  • Usage
    • This filter allows you to modify the registration notices for the sales agent registration process.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('sc_agent_register_notices', 'custom_sc_agent_register_notices');

function custom_sc_agent_register_notices($messages) {
    // Modify or add messages based on your specific logic
    // Example: Modify the 'success' message
    $messages['success'] = __( 'You have been successfully registered.', 'sales-agent' );

    // Example: Add a new message
    $messages['custom_message'] = __( 'This is a custom message.', 'sales-agent' );

    return $messages;
}

Filter: wc_agent_additional_css_formbuilder #

  • Data Type
    • String: $extra_css – Additional CSS styles for the form builder.
  • Arguments
    • (String): $extra_css – Additional CSS styles for the form builder.
  • Usage
    • This filter allows you to modify or add additional CSS styles for the form builder in the sales agent plugin.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('wc_agent_additional_css_formbuilder', 'custom_wc_agent_additional_css_formbuilder');

function custom_wc_agent_additional_css_formbuilder($extra_css) {
    // Modify or add additional CSS styles based on your specific needs
    $modified_css = $extra_css . '
        /* Additional CSS styles */
        .custom-class { 
            color: #333;
            font-size: 16px;
        }
    ';

    return $modified_css;
}

Filter: wc_agent_additional_field_formbuilder #

  • Data Type
    • Array: $mendatory_fields – Array containing the mandatory fields for the form builder.
  • Arguments
    • (Array): $mendatory_fields – Array containing the mandatory fields for the form builder.
  • Usage
    • This filter allows you to modify or add additional mandatory fields for the form builder in the sales agent plugin.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('wc_agent_additional_field_formbuilder', 'custom_wc_agent_additional_field_formbuilder');

function custom_wc_agent_additional_field_formbuilder($mendatory_fields) {
    // Modify or add additional mandatory fields based on your specific needs
    $additional_fields = array(
        array(
            'type' => 'text',
            'key' => 'additional_field',
            'label' => 'Additional Field',
            'required' => true,
            // Add more parameters as needed
        ),
        // Add more fields as needed
    );

    // Merge additional fields with existing mandatory fields
    $mendatory_fields = array_merge($mendatory_fields, $additional_fields);
    return $mendatory_fields;
}

Filter: wc_agents_settings_title #

  • Data Type
    • String: $setting_title – The title for the settings section.
  • Arguments
    • (String): $setting_title – The title for the settings section.
  • Usage
    • This filter allows you to modify the title for the general settings section in the sales agent plugin.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('wc_agents_settings_title', 'custom_wc_agents_settings_title');

function custom_wc_agents_settings_title($setting_title) {
    // Modify the title for the general settings section
    $modified_title = $setting_title . ' (Modified)';

    return $modified_title;
}

Filter: safw_user_registration #

  • Data Type
    • bool: $flag – Boolean flag indicating whether user registration should proceed.
  • Arguments
    • (bool): $flag – Boolean flag indicating whether user registration should proceed.
  • Usage
    • This filter allows you to control whether user registration should proceed in the sales agent plugin.
    • Return true to allow user registration or false to prevent it.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('safw_user_registration', 'custom_safw_user_registration');

function custom_safw_user_registration($flag) {
    // Implement your logic to determine if user registration should proceed
    // For example, conditionally allow or block user registration based on some criteria
    if (/* your condition here */) {
        return true; // Allow user registration
    } else {
        return false; // Block user registration
    }
}

Filter: auth_cookie_expiration #

  • Data Type
    • int: $expiration – Integer representing the duration of the authentication cookie expiration time in seconds.
    • int|null: $user_id – Integer representing the ID of the user for whom the authentication cookie is being set, or null if not available.
    • bool: $remember – Boolean flag indicating whether the user chose to be remembered.
  • Arguments
    • (int): $expiration – Integer representing the default duration of the authentication cookie expiration time in seconds.
    • (int|null): $user_id – Integer representing the ID of the user for whom the authentication cookie is being set, or null if not available.
    • (bool): $remember – Boolean flag indicating whether the user chose to be remembered.
  • Usage
    • This filter allows you to modify the expiration time of the authentication cookie for user sessions.
    • Return an integer representing the desired expiration time in seconds.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('auth_cookie_expiration', 'custom_auth_cookie_expiration', 10, 3);

function custom_auth_cookie_expiration($expiration, $user_id, $remember) {
    // Implement your logic to modify the expiration time of the authentication cookie
    // For example, increase or decrease the default expiration time based on user conditions
    // Here's a simple example to double the default expiration time:
    $new_expiration = $expiration * 2;

    return $new_expiration;
}

Filter: logout_redirect #

  • Data Type
    • string: $redirect_to – The URL to redirect to after logout.
    • string|null: $requested_redirect_to – The requested redirect URL before logout.
    • WP_User|null: $old_user – The WP_User object of the user who is logging out, or null if not available.
  • Arguments
    • (string): $redirect_to – The URL to redirect to after logout.
    • (string|null): $requested_redirect_to – The requested redirect URL before logout.
    • (WP_User|null): $old_user – The WP_User object of the user who is logging out, or null if not available.
  • Usage
    • This filter allows you to modify the URL to which users are redirected after logging out.
    • Return a string representing the desired redirect URL.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('logout_redirect', 'custom_logout_redirect', 10, 3);

function custom_logout_redirect($redirect_to, $requested_redirect_to, $old_user) {
    // Implement your logic to determine the redirect URL after logout
    // For example, redirect to a specific page based on user roles or conditions
    // Here's a simple example to redirect all users to the homepage:
    $redirect_url = home_url('/');

    return $redirect_url;
}

Filter: login_redirect #

  • Data Type
    • string: $redirect_to – The URL to redirect to after login.
    • string|null: $requested_redirect_to – The requested redirect URL before login.
    • WP_User: $new_user – The WP_User object of the user who is logging in.
  • Arguments
    • (string): $redirect_to – The URL to redirect to after login.
    • (string|null): $requested_redirect_to – The requested redirect URL before login.
    • (WP_User): $new_user – The WP_User object of the user who is logging in.
  • Usage
    • This filter allows you to modify the URL to which users are redirected after logging in.
    • Return a string representing the desired redirect URL.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('login_redirect', 'custom_login_redirect', 10, 3);

function custom_login_redirect($redirect_to, $requested_redirect_to, $new_user) {
    // Implement your logic to determine the redirect URL after login
    // For example, redirect to a specific page based on user roles or conditions
    // Here's a simple example to redirect all users to the dashboard:
    $redirect_url = admin_url();

    return $redirect_url;
}

Filter: switch_back_to_agent_url #

  • Data Type
    • string: $switch_back_agent – The URL to switch back to the agent’s previous location.
  • Arguments
    • (string): $switch_back_agent – The URL to switch back to the agent’s previous location.
  • Usage
    • This filter allows you to modify or encode the URL to which the user should switch back to after a certain action.
    • Return a string representing the modified or encoded URL.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('switch_back_to_agent_url', 'custom_switch_back_agent_url');

function custom_switch_back_agent_url($switch_back_agent) {
    // Implement your logic to modify or encode the URL for switching back to the agent's previous location
    // Here's a simple example to urlencode the current URL
    $encoded_url = urlencode($switch_back_agent);

    return $encoded_url;
}

Filter: switch_back_to_agent_footer_url #

  • Data Type
    • string: $switch_back_agent – The URL to switch back to the agent’s previous location (typically for footer links).
  • Arguments
    • (string): $switch_back_agent – The URL to switch back to the agent’s previous location (typically for footer links).
  • Usage
    • This filter allows you to modify or encode the URL for footer links that switch back to the agent’s previous location.
    • Return a string representing the modified or encoded URL.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('switch_back_to_agent_footer_url', 'custom_switch_back_agent_footer_url');

function custom_switch_back_agent_footer_url($switch_back_agent) {
    // Implement your logic to modify or encode the footer URL for switching back to the agent's previous location
    // Here's a simple example to urlencode the current URL
    $encoded_url = urlencode($switch_back_agent);

    return $encoded_url;
}

Filter: before_add_commission_row #

  • Data Type
    • array: $args – Arguments array passed for adding a commission row.
  • Arguments
    • (array): $args – Arguments array passed for adding a commission row.
  • Usage
    • This filter allows you to modify the arguments array before adding a commission row.
    • Return an array with modified arguments or perform any necessary operations.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('before_add_commission_row', 'custom_before_add_commission_row');

function custom_before_add_commission_row($args) {
    // Modify the $args array or perform operations before adding a commission row
    // Example: Unset or manipulate specific keys in the $args array
    if (isset($args['some_key_to_modify'])) {
        // Modify the value of a specific key
        $args['some_key_to_modify'] = 'Modified Value';
    }

    // Perform additional operations as needed

    return $args;
}

Filter: before_update_commission_row #

  • Data Type
    • array: $update_args – Arguments array for updating a commission row.
    • array: $where – Array containing placeholders for WHERE clause.
  • Arguments
    • (array): $update_args – Arguments array for updating a commission row.
    • (array): $where – Array containing placeholders for WHERE clause.
  • Usage
    • This filter allows you to modify the update arguments array and WHERE clause placeholders
    • before updating a commission row in the database. Return modified arrays as needed.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('before_update_commission_row', 'custom_before_update_commission_row', 10, 2);

function custom_before_update_commission_row($update_args, $where) {
    // Modify the $update_args array or $where array before updating a commission row
    // Example: Adjust values or keys within $update_args based on your specific requirements
    if (isset($update_args['some_key_to_modify'])) {
        // Modify the value of a specific key
        $update_args['some_key_to_modify'] = 'Modified Value';
    }

    // Example: Modify the WHERE clause placeholders if needed
    foreach ($where as $key => $value) {
        // Modify or check each placeholder in $where array
        if ($key === 'some_key_in_where') {
            // Modify the value or condition as necessary
            $where[$key] = 'Modified Value';
        }
    }

    // Perform additional operations as needed

    return array($update_args, $where);
}

Filter: safw_admin_query_commission_list #

  • Data Type
    • array: $rows – Array of commission list results fetched from the database.
    • bool: $customer_date_flag – Flag indicating if customer ID and date range filter are applied.
    • bool: $only_date_flag – Flag indicating if only date range filter is applied.
    • int: $offset – Offset for pagination of results.
    • int: $per_page – Number of results per page.
  • Arguments
    • (array): $rows – Array of commission list results fetched from the database.
    • (bool): $customer_date_flag – Flag indicating if customer ID and date range filter are applied.
    • (bool): $only_date_flag – Flag indicating if only date range filter is applied.
    • (int): $offset – Offset for pagination of results.
    • (int): $per_page – Number of results per page.
  • Usage
    • This filter allows you to modify the commission list results fetched from the database
    • based on various conditions such as customer ID, date range, offset, and per page limit.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('safw_admin_query_commission_list', 
'custom_safw_admin_query_commission_list', 10, 5);

function custom_safw_admin_query_commission_list($rows, $customer_date_flag, $only_date_flag, $offset, $per_page) {
    // Modify $rows array based on your specific requirements
    // Example: Append additional data or manipulate existing data

    foreach ($rows as $index => $row) {
        // Example modification: Append a custom field to each row
        $rows[$index]->custom_field = 'Custom Value';
    }

    // Return the modified $rows array
    return $rows;
}

Filter: before_add_subcommission_row #

  • Data Type
    • array: $args – Array of arguments before adding a subcommission row.
  • Arguments
    • (array): $args – Array of arguments before adding a subcommission row.
  • Usage
    • This filter allows you to modify the arguments before adding a subcommission row
  • to the database table.
    • based on various conditions such as customer ID, date range, offset, and per page limit.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('safw_admin_query_commission_list', 
'custom_safw_admin_query_commission_list', 10, 5);

function custom_safw_admin_query_commission_list($rows, $customer_date_flag, $only_date_flag, $offset, $per_page) {
    // Modify $rows array based on your specific requirements
    // Example: Append additional data or manipulate existing data

    foreach ($rows as $index => $row) {
        // Example modification: Append a custom field to each row
        $rows[$index]->custom_field = 'Custom Value';
    }

    // Return the modified $rows array
    return $rows;
}

Filter: before_update_subcommission_row #

  • Data Type
    • array: $update_args – Array of arguments before updating a subcommission row.
    • array: $where – Array of placeholder values for the update query WHERE clause.
  • Arguments
    • (array): $update_args – Array of arguments before updating a subcommission row.
    • (array): $where – Array of placeholder values for the update query WHERE clause.
  • Usage
    • This filter allows you to modify the arguments before adding a subcommission row to the database table.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('before_update_subcommission_row', 'custom_before_update_subcommission_row', 10, 2);

function custom_before_update_subcommission_row($update_args, $where) {
    // Modify $update_args and $where arrays based on your specific requirements
    // Example: Append additional data or manipulate existing data

    $updated_update_args = array();
    $updated_where = array();

    foreach ($update_args as $key => $value) {
        // Example modification: Ensure certain fields are correctly set before updating
        if ($key === 'commission_value' && empty($value)) {
            $updated_update_args[$key] = 0; // Set a default commission value if it's empty
        } else {
            $updated_update_args[$key] = $value;
        }
    }

    foreach ($where as $key => $value) {
        // Example modification: Ensure certain WHERE clause placeholders are correctly set
        if ($key === 'id' && empty($value)) {
            $updated_where[$key] = 0; // Set a default ID if it's empty
        } else {
            $updated_where[$key] = $value;
        }
    }

    // Return the modified $update_args and $where arrays
    return array($updated_update_args, $updated_where);
}

Filter: safw_admin_query_sub_commission_list #

  • Data Type
    • array: $rows – Array of subcommission rows fetched from the database.
    • int: $offset – Offset value for pagination.
    • int: $per_page – Number of items per page for pagination.
  • Arguments
    • (array): $rows – Array of subcommission rows fetched from the database.
    • (int): $offset – Offset value for pagination.
    • (int): $per_page – Number of items per page for pagination.
  • Usage
    • This filter allows you to modify the array of subcommission rows fetched from the database before returning it for display in the admin subcommission list.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('safw_admin_query_sub_commission_list', 'custom_safw_admin_query_sub_commission_list', 10, 3);

function custom_safw_admin_query_sub_commission_list($rows, $offset, $per_page) {
    // Modify $rows array based on your specific requirements
    // Example: Add additional data, filter out specific rows, or reorder rows

    // Example modification: Append additional information to each row
    foreach ($rows as &$row) {
        $row->additional_info = 'Custom additional information';
    }

    // Return the modified $rows array
    return $rows;
}

Filter: after_get_sub_commissions_total_list_data #

  • Data Type
    • int: $rows – The total count of subcommission records for the specified agent ID.
  • Arguments
    • (int): $rows – The total count of subcommission records for the specified agent ID.
  • Usage
    • This filter allows you to modify the total count of subcommission records fetched from the database before it is returned.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('after_get_sub_commissions_total_list_data', 'custom_after_get_sub_commissions_total_list_data', 10, 1);

function custom_after_get_sub_commissions_total_list_data($rows) {
    // Modify $rows (total count of subcommission records) based on your specific requirements

    // Example modification: Add 100 to the total count
    $modified_rows = $rows + 100;

    // Return the modified total count
    return $modified_rows;
}

Filter: total_subcommission_amount #

  • Data Type
    • int: $rows – The total sum of subcommission amounts based on the specified agent ID and status.
  • Arguments
    • (int): $rows – The total sum of subcommission amounts.
  • Usage
    • This filter allows you to modify the total sum of subcommission amounts fetched from the database based on the agent ID and subcommission status before it is returned.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('total_subcommission_amount', 'custom_total_subcommission_amount', 10, 1);

function custom_total_subcommission_amount($rows) {
    // Modify $rows (total sum of subcommission amounts) based on your specific requirements

    // Example modification: Double the total sum
    $modified_rows = $rows * 2;

    // Return the modified total sum
    return $modified_rows;
}

Filter: wc_agent_user_switching_send_auth_cookies #

  • Data Type
    • bool: $send_cookies – Whether to send authentication cookies during user switching.
  • Arguments
    • (bool): $send_cookies – Current status of sending authentication cookies.
  • Usage
    • This filter allows you to control whether authentication cookies should be sent during user switching.
    • Return `true` to send cookies, `false` to prevent sending cookies.
// Add this in your theme's functions.php file or in a custom plugin

add_filter('wc_agent_user_switching_send_auth_cookies', 'custom_send_auth_cookies', 10, 1);

function custom_send_auth_cookies($send_cookies) {
    // Modify $send_cookies based on your specific logic

    // Example modification: Always send authentication cookies
    return true;
}

Filter: auth_cookie_expiration #

Adjusts the expiration time of the authentication cookie.

  • Data Type
    • int: $expiration – Default expiration time calculated by WordPress.
    • int: $user_id – User ID.
    • bool: $remember – Whether to remember the user.
  • Arguments
    • (int): $expiration – Default expiration time calculated by WordPress.
    • (int): $user_id – User ID
    • (bool): $remember – Whether to remember the user.
  • Usage
    • This filter allows you to adjust the expiration time of the authentication cookie.
    • Return an integer representing the adjusted expiration time in seconds.
add_filter( 'auth_cookie_expiration', 'custom_auth_cookie_expiration', 10, 3 );

function custom_auth_cookie_expiration( $expiration, $user_id, $remember ) {
    // Example: Extend expiration for all users to 30 days
    return 30 * DAY_IN_SECONDS;
}

Filter: secure_logged_in_cookie #

Filters whether the logged in cookie should only be sent over HTTPS.

  • Data Type
    • bool: $secure_logged_in_cookie – Whether the logged in cookie should only be sent over HTTPS.
    • int: $user_id – User ID.
    • bool: $secure – Whether the auth cookie should only be sent over HTTPS.
  • Arguments
    • (bool): $secure_logged_in_cookie – Whether the logged in cookie should only be sent over HTTPS.
    • (int): $user_id – User ID.
    • (bool): $secure – Whether the auth cookie should only be sent over HTTPS.
  • Usage
    • This filter allows you to control whether the logged in cookie should only be sent over HTTPS.
    • Return `true` to enforce HTTPS for the logged in cookie, `false` to use the default behavior.
add_filter( 'secure_logged_in_cookie', 'customize_secure_logged_in_cookie', 10, 3 );

function customize_secure_logged_in_cookie( $secure_logged_in_cookie, $user_id, $secure ) {
    // Customize the $secure_logged_in_cookie based on your logic
    // Example: Always enforce HTTPS for the logged in cookie if $secure is true
    if ( $secure ) {
        $secure_logged_in_cookie = true;
    }

    // Return adjusted value
    return $secure_logged_in_cookie;
}

Filter: secure_logged_in_cookie #

Filters whether the logged in cookie should only be sent over HTTPS.

  • Data Type
    • bool: $secure_logged_in_cookie – Whether the logged in cookie should only be sent over HTTPS.
    • int: $user_id – User ID.
    • bool: $secure – Whether the auth cookie should only be sent over HTTPS.
  • Arguments
    • (bool): $secure_logged_in_cookie – Whether the logged in cookie should only be sent over HTTPS.
    • (int): $user_id – User ID.
    • (bool): $secure – Whether the auth cookie should only be sent over HTTPS.
  • Usage
    • This filter allows you to control whether the logged in cookie should only be sent over HTTPS.
    • Return `true` to enforce HTTPS for the logged in cookie, `false` to use the default behavior.
add_filter( 'secure_logged_in_cookie', 'customize_secure_logged_in_cookie', 10, 3 );

function customize_secure_logged_in_cookie( $secure_logged_in_cookie, $user_id, $secure ) {
    // Customize the $secure_logged_in_cookie based on your logic
    // Example: Always enforce HTTPS for the logged in cookie if $secure is true
    if ( $secure ) {
        $secure_logged_in_cookie = true;
    }

Filter: send_auth_cookies #

Filters whether authentication cookies should be sent.

  • Data Type
    • bool: $send_cookies – Whether to send authentication cookies.
    • int: $expire – Expiration time of the cookie.
    • int: $expiration – Expiration time of the authentication cookie.
    • int: $user_id – User ID.
    • string: $scheme – Authentication scheme (‘auth’ or ‘secure_auth’).
    • string: $token – Authentication token.
  • Arguments
    • (bool): $send_cookies – Current status of sending authentication cookies.
    • (int): $expire – Expiration time of the cookie.
    • (int): $expiration – Expiration time of the authentication cookie.
    • (int): $user_id – User ID.
    • (string): $scheme – Authentication scheme (‘auth’ or ‘secure_auth’).
    • (string): $token – Authentication token.
  • Usage
    • This filter allows you to control whether authentication cookies should be sent.
    • Return `true` to send cookies, `false` to prevent sending cookies.
add_filter( 'send_auth_cookies', 'customize_send_auth_cookies', 10, 6 );

function customize_send_auth_cookies( $send_cookies, $expire, $expiration, $user_id, $scheme, $token ) {
    // Customize the $send_cookies based on your logic
    // Example: Prevent sending cookies if $user_id is 0 (anonymous user)
    if ( $user_id === 0 ) {
        $send_cookies = false;
    }

    // Return adjusted value
    return $send_cookies;
}

Filter: wc_salesagent_allow_role_for_create_salesagent_API #

Filters the roles allowed to create a sales agent via API.

  • Data Type
    • array: $allowed_roles – Array of role slugs that are allowed to create a sales agent.
    • WP_User: $user – WP_User object representing the current user.
  • Arguments
    • (array): $allowed_roles – Array of role slugs that are allowed to create a sales agent.
    • (WP_User): $user – WP_User object representing the current user.
  • Usage
    • This filter allows you to customize which roles are allowed to create a sales agent via API.
    • Return an array of role slugs that should be allowed.
add_filter( 'wc_salesagent_allow_role_for_create_salesagent_API', 'customize_salesagent_create_roles', 10, 2 );

function customize_salesagent_create_roles( $allowed_roles, $user ) {
    // Example: Only allow administrators to create sales agents via API
    $allowed_roles = array( 'administrator' );

    // Return adjusted roles array
    return $allowed_roles;
}

Filter: wc_custom_required_fields #

Defines the required fields and validation rules for custom commission categories.

  • Data Type
    • array: $required_fields – Array of required fields and validation rules.
  • Arguments
    • (array): $required_fields – Array of required fields and validation rules for custom commission categories.
  • Usage
    • This filter allows you to define the required fields and validation rules for custom commission categories.
    • Modify the array to specify required fields and their validation rules.
add_filter( 'wc_custom_required_fields', 'customize_custom_required_fields', 10, 1 );

function customize_custom_required_fields( $required_fields ) {
    // Example: Adjust or add required fields and validation rules
    $required_fields = array(
        'commission_category_name'     => '',
        'commission_category_desc'     => '',
        'commission_type'              => array( 'percentage', 'fixed' ),
        'commission_value'             => 'is_numeric',
        'commission_system'            => array( 'order-basis', 'earning-basis' ),
        'commission_product_category'  => array( 'commission_on_product', 'commission_on_category' ),
        'per_product_commission'       => 'is_numeric',
        'product_subtotal_commission'  => 'is_numeric',
    );

    // Return adjusted array of required fields
    return $required_fields;
}

Filter: woocommerce_save_account_details_required_fields #

Filters the required account details fields during WooCommerce account save process.

  • Data Type
    • array: $validation – Array of required fields with their keys and names.
  • Arguments
    • (array): $validation – Array of required fields with their keys and names.
  • Usage
    • This filter allows you to modify or add required account details fields during the WooCommerce account save process.
    • Adjust the array to specify required fields and their respective names.
add_filter( 'woocommerce_save_account_details_required_fields', 'customize_account_details_required_fields', 10, 1 );

function customize_account_details_required_fields( $validation ) {
    // Example: Customize or add required account details fields
    $validation = array(
        'billing_first_name' => __( 'First Name', 'your-textdomain' ),
        'billing_last_name'  => __( 'Last Name', 'your-textdomain' ),
        'billing_email'      => __( 'Email', 'your-textdomain' ),
        // Add more fields as needed
    );

    // Return adjusted array of required fields
    return $validation;
}

Filter: wc_agent_agent_customers_endpoint_title #

Filters the title for the Customers endpoint in the Sales Agent plugin.

  • Data Type
    • string: $title – The default title for the Customers endpoint.
  • Arguments
    • (string): $title – The default title for the Customers endpoint.
  • Usage
    • This filter allows you to modify the title displayed for the Customers endpoint in the Sales Agent plugin.
    • Adjust the string returned to change the endpoint title according to your preferences or localization.
add_filter( 'wc_agent_agent_customers_endpoint_title', 'customize_customers_endpoint_title', 10, 1 );

function customize_customers_endpoint_title( $title ) {
    // Example: Modify the Customers endpoint title
    $title = __( 'My Clients', 'your-textdomain' );

    // Return the modified title
    return $title;
}

Filter: sales_agent_dashboard_runtime_date #

Filters the runtime date format for the Sales Agent dashboard countdown timer.

  • Data Type
    • array: $runtime_date_format – Array containing keys for day, hour, minute, and second.
  • Arguments
    • (array): $runtime_date_format – Array with keys ‘day’, ‘hour’, ‘minute’, ‘second’ mapping to format strings.
  • Usage
    • This filter allows you to modify the format of the countdown timer displayed in the Sales Agent dashboard.
    • Adjust the format strings for day, hour, minute, and second to customize how the countdown timer appears.
add_filter( 'sales_agent_dashboard_runtime_date', 'customize_runtime_date_format', 10, 1 );

function customize_runtime_date_format( $runtime_date_format ) {
    // Example: Modify the runtime date format
    $runtime_date_format = array(
        'day'    => 'd',
        'hour'   => 'h',
        'minute' => 'm',
        'second' => 's',
    );
    // Return the modified runtime date format
    return $runtime_date_format;
}

Filter: wc_agent_dashboard_endpoint_title #

Filters the title for the Sales Agent dashboard endpoint.

  • Data Type
    • string: $title – The title displayed for the Sales Agent dashboard endpoint.
  • Arguments
    • (string): $title – The default title for the Sales Agent dashboard endpoint.
  • Usage
    • This filter allows you to modify the title displayed for the Sales Agent dashboard endpoint.
    • Return a customized string to change the title as per your requirements.
add_filter( 'wc_agent_dashboard_endpoint_title', 'custom_sales_agent_dashboard_title' );

function custom_sales_agent_dashboard_title( $title ) {
    // Modify the dashboard endpoint title here
    // Example: Append a suffix to the title
    $modified_title = $title . ' - Customized';
    
    return $modified_title;
}

Filter: wc_agent_agent_discount_endpoint_title #

Filters the title for the Sales Agent discount endpoint.

  • Data Type
    • string: $title – The title displayed for the Sales Agent discount endpoint.
  • Arguments
    • (string): $title – The default title for the Sales Agent discount endpoint.
  • Usage
    • This filter allows you to modify the title displayed for the Sales Agent discount endpoint.
    • Return a customized string to change the title as per your requirements.
add_filter( 'wc_agent_agent_discount_endpoint_title', 'custom_sales_agent_discount_title' );

function custom_sales_agent_discount_title( $title ) {
    // Modify the discount endpoint title here
    // Example: Append a suffix to the title
    $modified_title = $title . ' - Customized';
    
    return $modified_title;
}

 Filter: woocommerce_order_item_class #

Filters the CSS class for a WooCommerce order item in the frontend.

  • Data Type
    • string: $class – The default CSS class for the order item.
    • object: $order_item – The WooCommerce order item object.
    • array: $item – An array of order item data.
    • object: $order – The WooCommerce order object.
  • Arguments
    • (string): $class – The default CSS class for the order item.
    • (object): $order_item – The WooCommerce order item object.
    • (array): $item – An array of order item data.
    • (object): $order – The WooCommerce order object.
  • Usage
    • This filter allows you to modify the CSS class applied to a WooCommerce order item in the frontend.
    • Return a customized string to change or add to the CSS class as per your requirements.
add_filter( 'woocommerce_order_item_class', 'custom_woocommerce_order_item_class', 10, 4 );

function custom_woocommerce_order_item_class( $class, $order_item, $item, $order ) {
    // Add custom logic here to modify the class based on your requirements
    $class .= ' custom-class';

    // Return the modified class
    return $class;
}

 Filter: wc_agent_discount_menu_item #

Filters the label for the Sales Agent discount menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent discount menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent discount menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent discount menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_discount_menu_item', 'custom_sales_agent_discount_menu_item_label' );

function custom_sales_agent_discount_menu_item_label( $label ) {
    return __( 'Custom Agent Discount', 'sales-agent' );
}

Filter: wc_agent_statistics_menu_item #

Filters the label for the Sales Agent statistics menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent statistics menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent statistics menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent statistics menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_statistics_menu_item', 'custom_sales_agent_statistics_menu_item_label' );
function custom_sales_agent_statistics_menu_item_label( $label ) {
    return __( 'Custom Agent Statistics', 'sales-agent' );
}

Filter: wc_agent_subagent_menu_item #

Filters the label for the Sales Agent Subagents menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Subagents menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Subagents menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Subagents menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_subagent_menu_item', 'custom_sales_agent_subagent_menu_item_label' );

function custom_sales_agent_subagent_menu_item_label( $label ) {
    return __( 'Custom SubAgents', 'sales-agent' );
}

Filter: wc_agent_manager_menu_item #

Filters the label for the Sales Agent Manager menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Manager menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Manager menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Manager menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_manager_menu_item', 'custom_sales_agent_manager_menu_item_label' );

function custom_sales_agent_manager_menu_item_label( $label ) {
    return __( 'Custom Agent Manager', 'sales-agent' );
}

Filter: wc_agent_customers_menu_item #

Filters the label for the Sales Agent Customers menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Customers menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Customers menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Customers menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_customers_menu_item', 'custom_sales_agent_customers_menu_item_label' );

function custom_sales_agent_customers_menu_item_label( $label ) {
    return __( 'Custom Agent Customers', 'sales-agent' );
}

Filter: wc_agent_orders_menu_item #

Filters the label for the Sales Agent Orders menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Orders menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Orders menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Orders menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_orders_menu_item', 'custom_sales_agent_orders_menu_item_label' );

function custom_sales_agent_orders_menu_item_label( $label ) {
    return __( 'Custom Agent Orders', 'sales-agent' );
}

Filter: wc_agent_commissions_menu_item #

Filters the label for the Sales Agent Commissions menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Commissions menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Commissions menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Commissions menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_commissions_menu_item', 'custom_sales_agent_commissions_menu_item_label' );

function custom_sales_agent_commissions_menu_item_label( $label ) {
    return __( 'Custom Agent Commissions', 'sales-agent' );
}

Filter: wc_agent_messages_menu_item #

Filters the label for the Sales Agent Messages menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Messages menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Messages menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Messages menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_messages_menu_item', 'custom_sales_agent_messages_menu_item_label' );

function custom_sales_agent_messages_menu_item_label( $label ) {
    return __( 'Custom Messages', 'sales-agent' );
}

Filter: wc_agent_affiliate_links_menu_item #

Filters the label for the Sales Agent Affiliate Links menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Affiliate Links menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Affiliate Links menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Affiliate Links menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_affiliate_links_menu_item', 'custom_sales_agent_affiliate_links_menu_item_label' );

function custom_sales_agent_affiliate_links_menu_item_label( $label ) {
    return __( 'Custom Affiliate Links', 'sales-agent' );
}

Filter: wc_agent_cart_sharing_menu_item #

Filters the label for the Sales Agent Cart Sharing menu item.

  • Data Type
    • string: $label – The title displayed for the Sales Agent Cart Sharing menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Cart Sharing menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Cart Sharing menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_cart_sharing_menu_item', 'custom_sales_agent_cart_sharing_menu_item_label' );

function custom_sales_agent_cart_sharing_menu_item_label( $label ) {
    return __( 'Custom Cart Sharing', 'sales-agent' );
}

Filter: wc_agent_announcements_menu_item #

Filter: wc_agent_announcements_menu_item

  1. Data Type
    • string: $label – The title displayed for the Sales Agent Announcements menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Announcements menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Announcements menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_cart_sharing_menu_item', 'custom_sales_agent_cart_sharing_menu_item_label' );

function custom_sales_agent_cart_sharing_menu_item_label( $label ) {
    return __( 'Custom Cart Sharing', 'sales-agent' );
}

Filter: wc_agent_payout_menu_item #

Filters the label for the Sales Agent Payout menu item.

  1. Data Type
    • string: $label – The title displayed for the Sales Agent Payout menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Payout menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Payout menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_payout_menu_item', 'custom_sales_agent_payout_menu_item_label' );

function custom_sales_agent_payout_menu_item_label( $label ) {
    return __( 'Custom Payout', 'sales-agent' );
}

Filter: wc_agent_switch_back_menu_item #

Filters the label for the Sales Agent Switch Back menu item.

  1. Data Type
    • string: $label – The title displayed for the Sales Agent Switch Back menu item.
  • Arguments
    • (string): $label – The default label for the Sales Agent Switch Back menu item.
  • Usage
    • This filter allows you to modify the label displayed for the Sales Agent Switch Back menu item.
    • Return a customized string to change the label as per your requirements.
add_filter( 'wc_agent_switch_back_menu_item', 'custom_sales_agent_switch_back_menu_item_label' );

function custom_sales_agent_switch_back_menu_item_label( $label ) {
    return __( 'Custom Back To Agent', 'sales-agent' );
}

Filter: wc_agent_agent_manager_endpoint_title #

Filters the title for the Sales Agent Manager endpoint.

  1. Data Type
    • string: $title – The title displayed for the Sales Agent Manager endpoint.
  • Arguments
    • (string): $title – The default title for the Sales Agent Manager endpoint.
  • Usage
    • This filter allows you to modify the title displayed for the Sales Agent Manager endpoint.
    • Return a customized string to change the title as per your requirements.
add_filter( 'wc_agent_agent_manager_endpoint_title', 'custom_sales_agent_manager_endpoint_title' );

function custom_sales_agent_manager_endpoint_title( $title ) {
    // Modify the endpoint title here
    // Example: Append a suffix to the title
    $modified_title = $title . ' - Customized';
    
    return $modified_title;
}

Filter: safw_endpoint_payout_order_date_heading #

Filters the heading for the order date column in the payout endpoint.

  1. Data Type
    • string: $heading – The heading displayed for the order date column.
  • Arguments
    • (string): $heading – The default heading for the order date column.
  • Usage
    • This filter allows you to modify the heading displayed for the order date column in the payout endpoint.
    • Return a customized string to change the heading as per your requirements.
add_filter( 'safw_endpoint_payout_order_date_heading', 'custom_payout_order_date_heading' );

function custom_payout_order_date_heading( $heading ) {
    // Modify the heading as needed
    // Example: Change the heading to "Transaction Date"
    $modified_heading = __( 'Transaction Date', 'sales-agent' );
    
    return $modified_heading;
}

Filter: safw_endpoint_order_payout_date #

Filters the formatted order payout date.

  1. Data Type
    • string: $formatted_date – The formatted order payout date.
    • object: $item – The order item object containing the original date.
  • Arguments
    • (string): $formatted_date – The default formatted order payout date.
    • (object): $item – The order item object containing the original date.
  • Usage
    • This filter allows you to modify the formatted order payout date.
    • Return a customized string to change the date format as per your requirements.
add_filter( 'safw_endpoint_order_payout_date', 'custom_payout_order_date', 10, 2 );

function custom_payout_order_date( $formatted_date, $item ) {
    // Modify the date format as needed
    // Example: Change the date format to "d-m-Y"
    $modified_date = gmdate( 'd-m-Y', strtotime( $item->create_date ) );
    
    return $modified_date;
}

Filter: wc_agent_payout_fields #

Filters the HTML fields for the agent’s payout information.

  1. Data Type
    • string: $fields – The HTML string containing the fields for agent’s payout information.
  • Arguments
    • (string): $fields – The default HTML string containing the fields for agent’s payout information.
  • Usage
    • This filter allows you to modify the HTML fields displayed for the agent’s payout information.
    • Return a customized HTML string to change the fields as per your requirements.
add_filter( 'wc_agent_payout_fields', 'custom_agent_payout_fields' );

function custom_agent_payout_fields( $fields ) {
    // Modify the fields as needed
    // Example: Add an additional field for the agent's payout information
    $custom_field = '
        <div class="info-field">
            <label for="additional_info">' . esc_html__('Additional Info', 'sales-agent') . '</label><br>
            <input type="text" name="bank[additional_info]" class="info-field" value=""/>
        </div>';
        
    // Append the custom field to the existing fields
    $fields .= $custom_field;
    
    return $fields;
}

Filter: wc_agent_agent_subagent_endpoint_title #

Filters the title for the Sales Agent subagent endpoint.

  1. Data Type
    • string: $title – The title displayed for the Sales Agent subagent endpoint.
  • Arguments
    • (string): $title – The default title for the Sales Agent subagent endpoint.
  • Usage
    • This filter allows you to modify the title displayed for the Sales Agent subagent endpoint.
    • Return a customized string to change the title as per your requirements.
add_filter( 'wc_agent_agent_subagent_endpoint_title', 'custom_sales_agent_subagent_title' );

function custom_sales_agent_subagent_title( $title ) {
    // Modify the subagent endpoint title here
    // Example: Append a suffix to the title
    $modified_title = $title . ' - Customized';
    
    return $modified_title;
}

Filter: assign_manager_to_subagent_email_meesage #

Filters the email message sent to a subagent when a new sales manager is assigned.

  1. Data Type
    • string: $message_to_sub_agent – The formatted email message.
  • Arguments
    • (string): $message_to_sub_agent – The default formatted email message.
  • Usage
    • This filter allows you to modify the email message sent to a subagent when a new sales manager is assigned.
add_filter( 'assign_manager_to_subagent_email_meesage', 'custom_assign_manager_to_subagent_email_message' );

function custom_assign_manager_to_subagent_email_message( $message_to_sub_agent ) {
    // Modify the email message here
    // Example: Append additional information to the message
    $custom_message = $message_to_sub_agent . ' Please contact your new manager for further details.';
    
    return $custom_message;
}

Filter: assign_manager_to_subagent_email_meesage #

Filters the email message sent to a subagent when a new sales manager is assigned.

  • Data Type
    • string: $message – The formatted email message.
  • Arguments
    • (string): $message – The default formatted email message.
  • Usage
    • This filter allows you to modify the email message sent to a subagent when a new sales manager is assigned.
add_filter( 'assign_manager_to_subagent_email_meesage', 'custom_assign_manager_to_subagent_email_message' );

function custom_assign_manager_to_subagent_email_message( $message ) {
    // Modify the email message here
    // Example: Append additional information to the message
    $custom_message = $message . ' Please contact your new manager for further details.';
    
    return $custom_message;
}

Filter: assign_subagent_to_manager_email_meesage #

Filters the email message sent to a manager when a new sales subagent is assigned.

  • Data Type
    • string: $message – The formatted email message.
  • Arguments
    • (string): $message – The default formatted email message.
  • Usage
    • This filter allows you to modify the email message sent to a manager when a new sales subagent is assigned.
add_filter( 'assign_subagent_to_manager_email_meesage', 'custom_assign_subagent_to_manager_email_message' );

function custom_assign_subagent_to_manager_email_message( $message ) {
    // Modify the email message here
    // Example: Append additional information to the message
    $custom_message = $message . ' Please welcome your new subagent and provide necessary guidance.';
    
    return $custom_message;
}

Filter: wc_agent_plugin_name #

Filters the name of the Sales Agent plugin.

  • Data Type
    • string: $plg_name – The name of the Sales Agent plugin.
  • Arguments
    • (string): $plg_name – The default name of the Sales Agent plugin.
  • Usage
    • This filter allows you to modify the name of the Sales Agent plugin.
    • Return a customized string to change the plugin name as per your requirements.
// Example usage of the wc_agent_plugin_name filter
add_filter( 'wc_agent_plugin_name', 'custom_sales_agent_plugin_name' );

function custom_sales_agent_plugin_name( $plg_name ) {
    // Modify the plugin name here
    return esc_html__( 'Custom Agents', 'sales-agent' );
}

Filter: wc_agent_menu_position #

Filters the menu position for the Sales Agent custom post type.

  • Data Type
    • int: $menu_position – The position of the menu item for the Sales Agent custom post type.
  • Arguments
    • (int): $menu_position – The default position of the menu item.
  • Usage
    • This filter allows you to modify the position of the menu item for the Sales Agent custom post type.
    • Return a customized integer to change the menu position as per your requirements.
// Example usage of the wc_agent_menu_position filter
add_filter( 'wc_agent_menu_position', 'custom_sales_agent_menu_position' );

function custom_sales_agent_menu_position( $menu_position ) {
    // Modify the menu position here
    return 15; // Example: changing the menu position to 15
}

Filter: args_check_current_user_agent #

Filters the query arguments used to retrieve the current user’s agent.

  • Data Type
    • array: $args – The query arguments for retrieving the agent.
  • Arguments
    • (array): $args – The default query arguments used to fetch the agent.
  • Usage
    • This filter allows you to modify the query arguments for retrieving the current user’s agent.
    • Return a customized array of arguments to adjust the query as needed.
function custom_args_check_current_user_agent( $args ) {
    // Modify the query arguments here
    $args['post_type'] = 'custom_agent'; // Example: Change the post type to 'custom_agent'
    $args['meta_query'] = array(
        array(
            'key'   => 'user_id',
            'value' => get_current_user_id(),
            'compare' => '=',
        ),
    );
    
    return $args;
}
add_filter( 'args_check_current_user_agent', 'custom_args_check_current_user_agent' );

Filter: wc_agent_template #

Filters the path to the template file used in the Sales Agent plugin.

  • Data Type
    • string: $template_path – The path to the template file.
  • Arguments
    • (string): $template_path – The default path to the template file.
  • Usage
    • This filter allows you to modify the path to the template file used by the Sales Agent plugin.
    • You can return a customized path to change which template file is included.
function custom_wc_agent_template_path( $template_path ) {
    // Define a custom template path
    $custom_path = '/path/to/custom/template-file.php';
    
    // Return the custom path
    return $custom_path;
}

// Add the custom filter callback
add_filter( 'wc_agent_template', 'custom_wc_agent_template_path' );

Filter: wc_agent_switch_to_user #

Filters the URL for switching to a user in the Sales Agent plugin.

  • Data Type
    • string: $url – The URL to switch to the user.
  • Arguments
    • (string): $url – The default URL generated for switching to the user.
  • Usage
    • This filter allows you to modify the URL used for switching to a user. You can return a customized URL to change the behavior.
function custom_wc_agent_switch_to_user_url( $url ) {
    // Define a custom URL or modify the existing one
    $custom_url = $url . '&custom_param=value';
    
    // Return the modified URL
    return $custom_url;
}

// Add the custom filter callback
add_filter( 'wc_agent_switch_to_user', 'custom_wc_agent_switch_to_user_url' );

Filter: wc_agent_commission_status_filter #

Filters the status of the commission in the Sales Agent plugin.

  • Data Type
    • string: $commission_status – The default status of the commission.
  • Arguments
    • (string): $commission_status – The default status for the commission, e.g., ‘paid’.
  • Usage
    • This filter allows you to modify the status of the commission. You can return a customized status or perform additional logic based on your requirements.
function custom_wc_agent_commission_status( $commission_status ) {
    // Modify the commission status based on your requirements
    // Example: Change status to 'pending' if certain conditions are met
    if ( /* some condition */ ) {
        return 'pending';
    }
    
    // Return the default or modified status
    return $commission_status;
}

// Add the custom filter callback
add_filter('wc_agent_commission_status_filter', 'custom_wc_agent_commission_status');

Filter: safw_endpoint_comm_list_order_date_heading #

Filters the heading for the order date in the Sales Agent commission list endpoint.

  • Data Type
    • string: $heading – The default heading for the order date.
  • Arguments
    • (string): $heading – The default heading text, e.g., ‘Order Date’.
  • Usage
    • This filter allows you to modify the heading text for the order date in the Sales Agent commission list.
    • You can return a customized heading string to change how the order date heading appears.
function custom_comm_list_order_date_heading( $heading ) {
    // Modify the heading based on your requirements
    // Example: Change heading to 'Date of Order'
    return 'Date of Order';
}

// Add the custom filter callback
add_filter('safw_endpoint_comm_list_order_date_heading', 'custom_comm_list_order_date_heading');

Filter: safw_endpoint_order_comm_list_date #

Filters the date format for the order commission list in the Sales Agent endpoint.

  • Data Type
    • string: $date – The formatted date string for the order commission list.
  • Arguments
    • (string): $date – The default date string formatted as ‘F d,Y’.
    • (object): $item – The item object containing the `create_date` property.
  • Usage
    • This filter allows you to modify the date format displayed in the Sales Agent order commission list.
    • You can return a customized date string or format based on your requirements.
function custom_order_comm_list_date( $date, $item ) {
    // Modify the date format as needed
    // Example: Change format to 'd/m/Y' (day/month/year)
    return gmdate( 'd/m/Y', strtotime( $item->create_date ) );
}

// Add the custom filter callback
add_filter('safw_endpoint_order_comm_list_date', 'custom_order_comm_list_date', 10, 2);

Filter: wc_sales_agent_show_wholesale_roles #

Controls the visibility of wholesale roles in the Sales Agent view.

  • Data Type
    • bool: $show_wholesale_roles – Whether to show wholesale roles or not.
  • Arguments
    •  (bool): $show_wholesale_roles – The default value indicating whether wholesale roles should be shown.
  • Usage
    • This filter allows you to enable or disable the display of wholesale roles in the Sales Agent view.
    • Return `true` to show wholesale roles or `false` to hide them based on your requirements.
function custom_show_wholesale_roles( $show_wholesale_roles ) {
    // Example: Disable wholesale roles display
    return false;
}

// Add the custom filter callback
add_filter( 'wc_sales_agent_show_wholesale_roles', 'custom_show_wholesale_roles' );

Filter: sales_agent_dashboard_date_format #

Filters the format of the expiry date displayed in the Sales Agent dashboard.

  • Data Type
    • string: $expiry_date_format – The formatted expiry date string.
  • Arguments
    • (string): $expiry_date_format – The default formatted expiry date, using the format ‘m/d/Y h:i:s A’.
  • Usage
    • This filter allows you to customize the format of the expiry date shown in the Sales Agent dashboard.
    • You can return a new format string to adjust how the expiry date is displayed.
function custom_expiry_date_format( $expiry_date_format ) {
    // Example: Change the date format to 'Y-m-d H:i:s'
    return Date_i18n( 'Y-m-d H:i:s', strtotime( $expiry_date_format ) );
}

// Add the custom filter callback
add_filter( 'sales_agent_dashboard_date_format', 'custom_expiry_date_format' );

Filter: wc_agent_myaccount_pagination_previous #

Filters the URL for the “Previous” pagination link in the WooCommerce account area.

  • Data Type
    • string: $url – The URL for the “Previous” pagination link.
  • Arguments
    • (string): $url – The default URL for the “Previous” pagination link, generated by `wc_get_endpoint_url`.
    • (string): $end_point – The endpoint for which the URL is being generated.
  • Usage
    • This filter allows you to customize the URL for the “Previous” pagination link in the WooCommerce account area.
    • You can return a modified URL to adjust the link as needed.
function custom_previous_pagination_url( $url, $end_point ) {
    // Example: Append a query parameter to the URL
    $custom_url = add_query_arg( 'custom_param', 'value', $url );
    
    return $custom_url;
}
// Add the custom filter callback
add_filter( 'wc_agent_myaccount_pagination_previous', 'custom_previous_pagination_url', 10, 2 );

Filter: wc_agent_myaccount_pagination_next #

Filters the URL for the “Next” pagination link in the WooCommerce account area.

  • Data Type
    • string: $url – The URL for the “Next” pagination link.
  • Arguments
    • (string): $url – The default URL for the “Next” pagination link, generated by `wc_get_endpoint_url`
    • (string): $end_point – The endpoint for which the URL is being generated.
  • Usage
    • This filter allows you to customize the URL for the “Next” pagination link in the WooCommerce account area.
    • You can return a modified URL to adjust the link as needed.
function custom_next_pagination_url( $url, $end_point ) {
    // Example: Append a query parameter to the URL
    $custom_url = add_query_arg( 'custom_param', 'value', $url );
    
    return $custom_url;
}

// Add the custom filter callback
add_filter( 'wc_agent_myaccount_pagination_next', 'custom_next_pagination_url', 10, 2 );

Filter: plugin_locale #

Filters the locale used for loading the plugin’s text domain.

  • Data Type
    • string: $locale – The locale for loading the text domain.
  • Arguments
    • (string): $locale – The default locale retrieved from `get_locale()`.
    • (string): $domain – The text domain for which the locale is being applied.
  • Usage
    • This filter allows you to modify the locale used to load the text domain for the plugin.
    • Return a customized locale if needed, or modify the locale based on specific conditions.
function custom_plugin_locale( $locale, $domain ) {
    // Check if the domain is the one you want to modify.
    if ( 'sales-agent' === $domain ) {
        // Modify the locale if needed. For example:
        if ( 'fr_FR' === $locale ) {
            return 'fr_CA'; // Use Canadian French locale instead of French.
        }
    }

    return $locale; // Return the unmodified locale if no conditions are met.
}

// Add the filter to modify the locale for the 'sales-agent' text domain.
add_filter( 'plugin_locale', 'custom_plugin_locale', 10, 2 );

Filter: wc_agent_my_account_orders_columns_data #

Filters the order columns data array for the WooCommerce account orders page.

  • Data Type
    • array: $data – An associative array containing the order data for the account orders table.
    • WC_Order: $order – An instance of the WC_Order class representing the current order.
  • Arguments
    • (array): $data – The default data array containing order information. This array is modified to include additional columns.
    • (WC_Order): $order – The order object for which data is being modified.
  • Usage
    • This filter allows you to add or modify custom columns in the WooCommerce account orders table.
    • By applying this filter, you can extend the order data with additional fields such as ‘first_name’ and ‘company_name’.
    • The filtered data array is used to render the order details in the table.
function add_custom_account_orders_columns_data($data, $order) {
     // Add the first name to the order data
     $data['first_name'] = $order->get_billing_first_name();
 
     // Add the company name to the order data
      $data['company_name'] = $order->get_billing_company();
 
     // Return the modified data array
      return $data;
  }

 add_filter('wc_agent_my_account_orders_columns_data', 'add_custom_account_orders_columns_data', 10, 2);

Filter: wc_agent_my_account_orders_columns #

Filters the columns array for the WooCommerce account orders table.

  • Data Type
    • array: $columns – An associative array of column IDs and column names used in the account orders table.
  • Arguments
    • (array): $columns – The default columns array provided by `wc_get_account_orders_columns()`. This array contains the default columns displayed in the WooCommerce account orders table.
  • Usage
    • This filter allows you to modify the columns displayed in the WooCommerce account orders table.
    • By applying this filter, you can add, remove, or reorder columns in the table according to your needs.
    • The modified columns array will be used to render the columns in the orders table.
function customize_account_orders_columns($columns) {
      // Add a custom column for 'First Name'
     $columns['first_name'] = __('First Name', 'sales-agent');
 
      // Add a custom column for 'Company Name'
     $columns['company_name'] = __('Company Name', 'sales-agent');

      // Return the modified columns array
      return $columns;
  }
 
  add_filter('wc_agent_my_account_orders_columns', 'customize_account_orders_columns');

Filter: wc_agent_orders_per_page #

Filters the number of orders displayed per page in the WooCommerce agent orders view.

  • Data Type
    • int: $per_page – The number of orders to display per page.
  • Arguments
    • (int): $per_page – The default number of orders per page, usually retrieved from an option or set as a default value.
  • Usage
    • This filter allows you to modify the number of orders displayed per page in the WooCommerce agent orders view.
    •  By applying this filter, you can set a custom number of orders to display per page based on your needs or user preferences.
    • The modified value will be used in the pagination logic to determine how many orders are shown on each page.
add_filter('wc_agent_orders_per_page', function($per_page) 
 { 
   // Set a custom number of orders per page, e.g., 20 
   return 20;
 }
)