=== Subaccounts for WooCommerce ===
Contributors: mediaticus
Tags: sub account, company accounts, multi user, user switching, woocommerce b2b
Tested up to: 7.0
Requires PHP: 5.7
Stable tag: 2.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

The best subaccount management plugin for WooCommerce. Easily allow customers to create subaccounts or add users to their company accounts.

== Description ==

Easily allow customers to create subaccounts or add users to their company accounts, while giving them full control over subaccount details, order tracking, and purchase monitoring—all delivered through a powerful, extensible plugin.

## Subaccounts for WooCommerce – The most comprehensive subaccount management plugin for WooCommerce

The Subaccounts for WooCommerce plugin gives you everything you need to add powerful subaccount functionality to your store. <a href="https://subaccounts.pro/" target="_blank">Subaccounts Pro</a> (our premium version) and its extensions unlock even more advanced features.

The ability to create multiple subaccounts tied to a main parent account is extremely useful in the following scenarios:

* Companies that need to add and manage accounts for their employees
* Stores that need to place orders from multiple branches
* Businesses with multiple decision-makers involved in purchasing
* Parent accounts that need to supervise and monitor all subaccount activity (purchases, expenses, quotes, etc.), and even place orders on their behalf
* Company accounts that need to manage orders across different purchasing departments or multiple purchasing managers (B2B and similar cases)
* Sales agents or representatives who need to create new accounts for newly acquired customers and, if needed, place orders on their behalf

## 🏆 Main features

Subaccounts for WooCommerce (free version) provides support for the following features:

### Two subaccount modes available

Whether your customers need parent-level control over multiple separate subaccounts or the ability to add users to their company account, we've got them covered.

* **Multi-User mode:** This is the best option for company accounts that need to place orders across different purchasing departments or via multiple purchasing managers (B2B and similar).

* **Sub-User mode:** This is the ideal solution if you want to keep accounts separate while still allowing the parent account to maintain control and supervise subaccount activity (purchases, expenses, quotes, etc.).

### Frontend subaccount management

Allow customers to easily create new subaccounts and manage subaccount details, view subaccount orders, and monitor purchases with full visibility.

* Allow customers to add their own subaccounts (up to 10 subaccounts per parent account in the free version)
* Allow parent accounts to edit subaccount details, including billing and shipping addresses
* Allow customers to view and monitor subaccount orders directly from their own My Account area
* For each purchase display information about who did actually placed the order
* Allow parent accounts to switch forward and backward from their account to any subaccount user account using our advanced and secure user switching system

### Tailored Settings

* **Target Users Precisely** — Enable the subaccount system only for the roles you choose (including custom roles).
* **Assign Roles with Ease** — Automatically set specific roles for subaccounts created on the frontend.
* **Keep Roles Consistent** — Let subaccounts inherit the same roles as their parent.
* **Keep Roles in Sync** — Keep subaccount roles synchronized with the parent account.
* **Set Limits** — Control the number of subaccounts parent accounts can create.
* **Customize Appearance** — Customize the User Switcher Pane to match your theme's color scheme.

## 🚀 Premium features

<a href="https://subaccounts.pro/" target="_blank">Subaccounts Pro</a> (premium version) is an extended version of the plugin and includes the following additional features:

* **Unlimited Subaccounts** — Allow parent accounts (managers) to create an unlimited number of subaccounts.
* **Take Control** — Create, assign, and fully manage subaccounts directly from the WordPress admin dashboard.
* **Own Your Workflow** — Control who can create and manage subaccounts: customers, admins, or both.
* **Toggle Subaccount Access** — Easily activate or deactivate subaccounts whenever needed.
* **Streamline Billing and Shipping** — Force subaccounts to inherit parent account addresses effortlessly.
* **Stay Informed** — Include subaccount information in WooCommerce new order emails for admins, customers, or both.
* **Know Who's Ordering** — In the admin area, display who actually placed each order in the WooCommerce orders list and order pages.
* **Know Your Orders** — Display parent and subaccount information in the WooCommerce orders list.
* **See Account Relationships** — Display parent and subaccount information, including their relationships, in the WordPress users list page.
* **Filter Users with Ease** — Quickly filter customers by account type (e.g. parent accounts or subaccounts) or by parent account right from the admin dashboard Users list.
* **Frontend User Filtering** — Filter subaccounts by status (all, active, or deactivated).

Upgrade to *Subaccounts Pro* and get a full suite of tools to create and manage subaccounts in WooCommerce! 

Upgrading to **Subaccounts Pro** is easy: just install the free version of the plugin and navigate to: **Admin Dashboard → WooCommerce → Subaccounts → Add-Ons**. From there you will be able to easily and securely upgrade to the premium version of the plugin in just a few clicks. Alternatively, you can get Subaccounts Pro and its add-ons directly from our website: <a href="https://subaccounts.pro/" target="_blank">https://subaccounts.pro/</a>.

### 🔌 Add-Ons available

**Order Approval Add-On**: Give parent accounts full visibility and control by allowing them to review, edit, and approve or reject subaccount orders before they're completed.

**Supervisor Add-On**: Allow administrators to create a three-level nested account structure by assigning a Supervisor account as parent to multiple Manager account types (e.g. Supervisor → Manager → Subaccount).

### 🌐 Languages and translations

**Subaccounts for WooCommerce** is translation ready and is currently available in the following languages:

* English
* French
* Italian

<a href="https://translate.wordpress.org/projects/wp-plugins/subaccounts-for-woocommerce/" target="_blank">Translate Subaccounts for WooCommerce</a> into your language and earn big discounts on Subaccounts Pro and its add-ons!

== Installation ==

### Automatic installation
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't even need to leave your web browser. To do an automatic install of Subaccounts for WooCommerce, log in to your WordPress admin panel, navigate to the Plugins menu and click Add New.

In the search field type "Subaccounts for WooCommerce" and click Search Plugins. You can install it by simply clicking Install Now. After clicking that link you will be asked if you're sure you want to install the plugin. Click yes and WordPress will automatically complete the installation. After installation has finished, click the 'activate plugin' link.

### Manual installation via the WordPress interface
1. Download the plugin zip file to your computer
2. Go to the WordPress admin panel menu Plugins → Add New
3. Choose upload
4. Upload the plugin zip file, the plugin will now be installed
5. After installation has finished, click the 'activate plugin' link

### Manual installation via FTP
1. Download the plugin file to your computer and unzip it
2. Using an FTP program, or your hosting control panel, upload the unzipped plugin folder to your WordPress installation's wp-content/plugins/ directory.
3. Activate the plugin from the Plugins menu within the WordPress admin.


== Frequently Asked Questions ==

= What is a subaccount? =

A subaccount (or sub-account) is a secondary account that sits under a main parent account.

= What is a Manager? =

A **Manager** is a parent account.

= How many subaccounts can be created for each customer/subscriber? =

Subaccounts for WooCommerce (free version) gives you the possibility to create up to 10 subaccounts for each Manager (parent account). 

With *Subaccounts Pro* (premium version) each Manager can have an unlimited number of subaccounts.

= Can a parent account (Manager) place an order? =

Both parent accounts and subaccounts can place orders. Parent accounts can also place orders on behalf of subaccounts, while a subaccount can place orders only for itself.

= Is it possible to create multiple nested subaccounts (e.g. a subaccount of another subaccount)? =

Subaccounts for WooCommerce (free version), allows the creation of two account levels only: a main parent account (so called Manager) and one or more subaccounts tied to the parent account.

With the **Supervisor Add-On** it is possible to set a parent account (Supervisor) above a Manager account type, thus allowing you (as an administrator) to create a three-level structure of nested accounts.

= Is it possible for an Administrator to create and set a subaccount for a customer from the WordPress backend (admin dashboard)? =

This option, along with many others, is only available in *Subaccounts Pro*, the premium version of the plugin.

= Is it possible to switch from Sub-User to Multi-User mode and vice versa after some orders have already been placed? =

We have done our best to ensure the highest level of compatibility between the two modes. Despite this, switching from one mode to the other after some orders have already been placed may result in some data being inaccurate.

For this reason we strongly recommend that you choose the mode that best suits your needs and stick with it.

= Is the plugin compatible with the WooCommerce High-Performance Order Storage (HPOS) feature? =

Compatibility with the WooCommerce High-Performance Order Storage (HPOS) feature has been introduced in version 1.2.0 of the plugin.

= Is the plugin compatible with WooCommerce Checkout and Cart blocks? =

Compatibility with WooCommerce Checkout and Cart blocks has been introduced in version 1.9.0 of the plugin.

= Are there any shortcodes available? =

From version 1.0.8, the following shortcodes are available:

`[sfwc_user_switcher]`
`[sfwc_manage_subaccounts]`
`[sfwc_add_subaccount]`
`[sfwc_subaccount_orders]` (Available only if Sub-User mode is active)

= Does the plugin work on multisite installations? =

It should work, but please note that activating the plugin on the entire network is not supported at this time. However you may want to try activating the plugin individually on all the sites you need to use it on.

== Screenshots ==

1. Plugin Settings Page - Options Tab
2. Plugin Settings Page - Appearance Tab
3. Admin Order List Page (premium feature)
4. Admin Order Page
5. My Account - User Switcher
6. My Account - Subaccount Orders
7. My Account - Add Subaccount
8. My Account - Orders
9. Add/Manage Subaccount from Admin Side (premium feature)
10. Admin Users List Page (premium feature)


== Changelog ==

= 2.0.0 =
*Release Date May 25, 2026*

* **New** – Add header containing subaccount info on frontend 'Edit Subaccount' page.
* **New** – Ability to assign subaccounts while creating a new (parent) account in the backend (Subaccounts Pro required).
* **New** – Ability to assign a manager when editing subaccounts on the Edit User page in the backend (Subaccounts Pro required).
* **New** – Ability to activate/deactivate subaccounts (Subaccounts Pro required).
* **New** – On the 'Manage Subaccounts' frontend page, added the ability for parent accounts to filter subaccounts by status: all statuses, active, deactivated (Subaccounts Pro required).
* **Improvement** – Improved the admin notice displayed when WooCommerce is not installed and added an 'Install Now' button to install it.
* **Improvement** – When no subaccounts are present, display a notice and provide an option to add subaccounts when the `[sfwc_subaccount_orders]` shortcode is used.
* **Improvement** – Added dedicated classes to each accordion header and content section on the 'Edit Subaccount' frontend page.
* **Improvement** – Improved responsive design on the frontend for better mobile and tablet compatibility.
* **Improvement** – Updated Freemius SDK to version 2.13.1.
* **Fix** – Prevent unrelated users from appearing in the "User Switcher" and "Filter Orders" dropdowns when supervisors switch to a manager with no subaccounts.
* **Tweak** – Removed the 'Add subaccount' button from its dedicated tab and added it to the Manage Subaccounts page.
* **Tweak** – Minor UI improvements on the 'Subaccounts' page in My Account.
* **Tweak** – Minor UI improvements on the plugin settings page in the admin area.
* **Tweak** – Removed `Requires Plugins` from the plugin header in favor of using our custom internal activation/deactivation logic.
* **Tweak** – On the 'Subaccounts' page in My Account, hide the menu if the only menu item is 'Manage Subaccounts'.
* **Dev** – Added new hook: `sfwc_frontend_manage_subaccounts_filter_meta_query`, to allow developers to filter the user query for getting subaccounts.
* **Dev** – Added new hook: `sfwc_frontend_manage_subaccounts_before_user_list_table`, to allow developers to add extra data before the table on the Manage Subaccounts page.
* **Dev** – Added new hook: `sfwc_frontend_manage_subaccounts_table_headers`, to allow developers to add additional table headers in the frontend Manage Subaccounts HTML table.
* **Dev** – Added new hook: `sfwc_frontend_edit_subaccount_after_subaccount_summary`, to allow developers to add extra fields or data after the subaccount summary on the frontend "Edit Subaccount" page.
* **Dev** – Added helper function: `sfwc_get_customer_display_name()` to output the user display name based on the 'Customer Display Name' admin setting.
* **Dev** – Added helper function: `sfwc_is_account_deactivated()` to determine if a subaccount is deactivated.

= 1.9.3 =
*Release Date February 21, 2026*

* **Fix** – Before populating checkout fields, ensure the customer's Billing First Name, Billing Last Name, and Billing Email are set to prevent checkout validation errors.
* **Tweak** – Added `Author URI` in plugin header.
* **Tweak** – Changes in readme.txt file.

= 1.9.2 =
*Release Date December 3, 2025*

* **Fix** – Fix JavaScript console error `Cannot read properties of undefined (reading 'style')` thrown on the Subaccount Orders page when there are no orders.
* **Dev** – Removed backend notification about compatibility with WooCommerce Checkout and Cart blocks.

= 1.9.1 =
*Release Date November 25, 2025*

* **Improvement** – Update Freemius SDK to version 2.13.0.
* **Fix** – When using the wp_add_inline_script() function, use `var` instead of `const` for variable names, to avoid JS errors in the My Account area in some cases.

= 1.9.0 =
*Release Date October 30, 2025*

* **New** – Introduced support for WooCommerce Checkout and Cart blocks.
* **Fix** – When using wp_add_inline_script(), enqueue the JavaScript code in the footer to avoid issues related to dependencies. 
* **Dev** – Declared compatibility with WooCommerce Checkout and Cart blocks.
* **Dev** – Removed backend notification about incompatibility with WooCommerce Checkout and Cart blocks.
* **Dev** – Removed backend notification about shortcode name changes.

= 1.8.2 =
*Release Date October 2, 2025*

* **Fix** – Properly return checkout fields for standalone customers.

= 1.8.1 =
*Release Date October 1, 2025*

* **Fix** – Fix Managers not being able to view subaccount orders when Sub-User mode is enabled and the subaccount orders list page is rendered via the `[sfwc_subaccount_orders]` shortcode.

= 1.8.0 =
*Release Date September 30, 2025*

* **New** – The User Switcher form is now available as a shortcode `[sfwc_user_switcher]`.
* **Improvement** – Code improvements in the "Filter Orders" frontend form.
* **Improvement** – Improved compatibility with John Blackbourn's "User Switching" plugin.
* **Improvement** – Improved compatibility with Themekraft's "BuddyPress Integration for WooCommerce" plugin (premium version).
* **Improvement** – Update Freemius SDK to version 2.12.2.
* **Fix** – Fix `First Name`, `Last Name` and `Email` checkout fields not populating correctly if Multi-User mode is enabled and a subaccount is logged-in.
* **Fix** – General code improvements and fixes in all plugin shortcodes.
* **Fix** – Fix `setcookie(): Passing null to parameter #2 of type string is deprecated` thrown by PHP 8.1 and later versions.
* **Fix** – Fix `Call to a member function get_meta() on array` in the `sfwc_multi_user_change_reply_to_email_header_for_admin_notifications`.
* **Fix** – In the `sfwc_my_account_orders_order_placed_by()` function, make sure that `get_userdata()` does not return `false` before retrieving the user data.
* **Tweak** – In the frontend `Add Subaccount` form, hide the "Company" field if Multi-User mode is enabled.
* **Tweak** – Changed the names of the plugin shortcodes.
* **Tweak** – Removed the full stop punctuation mark at the end of field labels in plugin settings pages.
* **Tweak** – Minor CSS changes.
* **Dev** – CSS and JS assets grouped by packages.
* **Dev** – Reduced the use of scripts embedded in HTML/PHP code in favor of using the wp_add_inline_script() function.
* **Dev** – Renamed `sfwc_enqueue_frontend_style` function to `sfwc_enqueue_frontend_js_css`.
* **Dev** – Renamed `sfwc_enqueue_backend_style` function to `sfwc_enqueue_backend_js_css`.
* **Dev** – Removed functions `sfwc_enqueue_color_picker` and `sfwc_admin_inline_js_color_picker`.

= 1.7.0 =
*Release Date August 15, 2025*

* **New** – Provide admin with the ability to change the frontend `subaccount` endpoint.
* **New** – Provide admin with the ability to assign specific role(s) to subaccounts created on frontend.
* **New** – Provide admin with the ability to allow subaccounts to inherit the same roles as the parent account.
* **New** – Provide the ability to keep subaccount roles synchronized with the parent account roles.
* **New** – `Manage Subaccounts` page content now available as a shortcode.
* **New** – `Subaccount Orders` page content now available as a shortcode.
* **Improvement** – Code optimizations for the `Add Subaccount` shortcode.
* **Improvement** – Provide parent accounts with the ability to clear/reset order selection in the `Filter Orders` form on frontend.
* **Improvement** – If Multi-User mode is enabled, change the reply-to in the email headers for `new_order`, `cancelled_order`, `failed_order` WooCommerce email notifications.
* **Improvement** – Update Freemius SDK to version 2.12.1.
* **Fix** – In the user query of the `sfwc_query_users_for_possible_selection_as_subaccounts()` function, replace the `role` parameter with `role__in`.
* **Fix** – When sanitizing order numbers, preserve alphanumeric strings.
* **Fix** – Fix attempt to read property "roles" on false in the helper function `sfwc_is_user_role_valid()`.
* **Fix** – Fix `call to a member function get_user_id() on false` on the WooCommerce email preview screen when WooCommerce `Email Improvements` option is enabled.
* **Tweak** – By default show all orders on the `Subaccount Orders` page in the frontend.
* **Tweak** – Moved the `Subaccounts` menu item before the `Settings` item in the admin area.
* **Tweak** – Shorten the column title `Order Placed By` to `Placed By` on the orders list page on frontend.

= 1.6.7 =
*Release Date April 30, 2025*

* **Improvement** – Fix Broken Authentication vulnerability.

= 1.6.6 =
*Release Date April 15, 2025*

* **Fix** – Fix `sfwc_add_valid_roles` hook not working properly.
* **Fix** – Fix plugin not working properly when website permalink structure is set to `Plain`.
* **Fix** – Fix JavaScript issues that occur on front end when the `[woocommerce_my_account]` shortcode is placed within a `text` block instead of a `shortcode` block.
* **Fix** – Fix undefined `filter_account_type` on Edit Subaccount page in frontend.
* **Tweak** – Display `Account`, `Contact Us` and `Add-ons` submenu items as plugin tabs in the backend.
* **Tweak** – Provide both a HTML `class` and a unique HTML `id` for each navigation tab present in the `Subaccount` page on frontend.
* **Tweak** – Provide HTML classes for each table column on the frontend `Manage Subaccounts` table.
* **Tweak** – Changed the HTML markup of the fields in the "Account Details" section of the `Edit Subaccount` frontend form.
* **Tweak** – Changed the HTML markup of the fields in the `Add Subaccount` frontend form.
* **Tweak** – Minor CSS changes.
* **Tweak** – Minor text strings changes.
* **Dev** – Improvements to the helper functions: `sfwc_is_current_user_role_valid()`, `sfwc_is_user_role_valid()` and `sfwc_get_valid_roles()`.
* **Dev** – Added new hook: `sfwc_edit_subaccount_form_tag`, to allow developers to add extra attributes to the frontend `Edit Subaccount` form tag.
* **Dev** – Added new hook: `sfwc_add_subaccount_form_tag`, to allow developers to add extra attributes to the frontend `Add Subaccount` form tag.
* **Dev** – Added new hook: `sfwc_frontend_add_subaccount_form_after_fields`, to allow developers to add additional fields on frontend subaccount creation form.

= 1.6.5 =
*Release Date January 27, 2025*

* **Improvement** – Updated Freemius SDK to version 2.11.0.

= 1.6.4 =
*Release Date January 15, 2025*

* **Fix** – If the `Choose who can create and add new subaccounts` option is set to `Admin Only`, do not show the "Add subaccount" button in the notice that appears on the "Manage subaccounts" page when there are no subaccounts yet.
* **Fix** – Correctly hide/show the "Manage Subaccounts" page loading icon on frontend.
* **Fix** – Fixed plugin activation issues on multisite installations.

= 1.6.3 =
*Release Date January 10, 2025*

* **Improvement** – Added "All" filter, to show managers along with their subaccounts on the `Manage Subaccounts` page on frontend (Subaccounts Pro and Supervisor Add-On required).
* **Improvement** – If Multi-User mode is enabled, make `First Name`, `Last Name` and `Email` fields readonly on the checkout page.
* **Improvement** – If the `Customer Display Name` option is set to `Company + Email` and the company name of the parent account is the same as the company name of the subaccount, for the subaccount show `Full Name` instead of `Company Name`.
* **Improvement** – Updated Freemius SDK to version 2.10.1.
* **Fix** – Fixed order confirmation email not being sent to guest users when multi-user mode is enabled.
* **Fix** – If Multi-User mode is enabled, do not show the `Filter Orders` form on frontend for customers whose roles are not enabled in the plugin settings.
* **Fix** – If Multi-User mode is enabled, do not show the `Order Placed By` column on the `Orders` page on frontend for customers whose roles are not enabled in the plugin settings.
* **Fix** – Allow validation of additional roles added via the `sfwc_add_valid_roles` filter when adding new subaccounts on frontend.
* **Fix** – Fixed `jQuery not defined` if loading of JavaScript is deferred.
* **Tweak** – Removed `for himself` string.
* **Tweak** – Provided a HTML `id` to the box containing order information on the single order page on frontend.
* **Tweak** – Minor CSS changes.

= 1.6.2 =
*Release Date November 21, 2024*

* **Fix** – Call to undefined function `sfwc_query_users_for_possible_selection_as_subaccounts()` resulting in the User Switcher not loading subaccounts.
* **Fix** – Check if nonce exists before trying to verify it when the User Switcher form is submitted.

= 1.6.1 =
*Release Date November 20, 2024*

* **Improvement** – Code improvements and security hardening.

= 1.6.0 =
*Release Date November 15, 2024*

* **Improvement** – Load subaccounts present in both the User Switcher dropdown menu and the Subaccount Orders dropdown menu using Ajax search and infinite scroll to reduce memory usage for user queries.
* **Improvement** – Updated Selectize CSS/JS to version 0.15.2.
* **Improvement** – Updated Freemius SDK to version 2.9.0.
* **Fix** – When obtaining subaccounts from the parent, a check has been added to ensure that the "Account Type" of the subaccounts is correct (to avoid inconsistencies if the subaccount's Account Type is later changed).
* **Dev** – Added new filter: `sfwc_add_valid_roles`, to allow developers to declare additional user roles as valid (`SFWC_VALID_ROLE_LOOSE_MODE` constant has to be defined and set to `true` in wp-config.php file).
* **Dev** – Added helper function: `sfwc_get_valid_roles` to determine which roles are valid.

= 1.5.6 =
*Release Date July 30, 2024*

* **Improvement** – Updated Freemius SDK to version 2.7.3.
* **Fix** – Fixed order metadata not being saved when creating new orders on block-enabled themes using the block-based Checkout page.
* **Tweak** – Added back-end notice about incompatibility with WooCommerce Blocks.
* **Dev** – Declared incompatibility with WooCommerce Blocks.

= 1.5.5 =
*Release Date May 30, 2024*

* **Improvement** – Updated Freemius SDK to version 2.7.2.
* **Dev** – Added new hook: `sfwc_frontend_edit_subaccount_after_account_details_fields`, to allow developers to add extra fields in the `Account Details` tab on the frontend `Edit Subaccount` page.
* **Dev** – Added new hook: `sfwc_frontend_after_edit_subaccount_validation`, to allow developers to save extra data when editing a subaccount on frontend.

= 1.5.4 =
*Release Date April 2, 2024*

* **Improvement** – Flush permalinks to avoid `Error 404` on front-end `subaccounts` endpoint.
* **Improvement** – Compatibility with Pantheon hosting provider.
* **Fix** – Fixed front-end `Manage Subaccounts` tab not loading content in some cases.
* **Tweak** – Added tooltip text for the option `Select the buyer role(s) to enable the subaccount system for`.
* **Tweak** – Minor changes in `readme.txt` file.
* **Dev** – Provide possibility to add prefix to cookie names.
* **Dev** – Removed no longer necessary `SFWC_REQUIRES_PERMALINK_UPDATE` PHP constant and related code.

= 1.5.3 =
*Release Date March 25, 2024*

* **Tweak** – Conditionally hide part of front-end notice about successful subaccount creation if user switcher is disabled.
* **Dev** – Removed code previously used for back-end notice about `Order Approval Add-On` release.
* **Dev** – Added `blueprint.json` to enable `Live Preview` button.
* **Dev** – Added new `Requires Plugins` header.

= 1.5.2 =
*Release Date February 15, 2024*

* **Fix** – Make sure JavaScript functions are called after page load.

= 1.5.1 =
*Release Date February 5, 2024*

* **Improvement** – Minor CSS improvements.
* **Improvement** – Updated Freemius SDK to version 2.6.2.
* **Tweak** – Added the `Edit order` button among those that can be shown in case `Order Approval Add-On` is active.
* **Tweak** – Added back-end notice about `Order Approval Add-On` release.
* **Dev** – Added new hook: `sfwc_frontend_edit_subaccount_accordion`, to allow developers to add additional accordion tabs on the `Edit subaccount` page on front end.
* **Dev** – Changed priority of function: `sfwc_order_placed_by_update_order_meta_after_payment`, to prevent a race condition in case `Order Approval Add-On` is active.

= 1.5.0 =
*Release Date December 20, 2023*

* **New** – `Multi-User` feature officially released (no longer in beta stage).
* **New** – Possibility to enable/disable the user switcher.
* **Improvement** – If Multi-User mode is enabled, when an order is placed by a subaccount or by a Manager on behalf of a subaccount, send the WC email notification to the subaccount.
* **Improvement** – Keep users selected in the `Filter Orders` front-end form while navigating through order list pages when Multi-User mode is enabled.
* **Improvement** – Display `On behalf of` value in the `Order placed by` column on front-end order list page when an order is placed by a Supervisor on behalf of a Manager or Subaccount with Multi-User mode enabled.
* **Improvement** – Better handling of those situations where an order was placed without storing the `_sfwc_order_placed_by_user_id` order meta value (prior to version 1.4.3).
* **Improvement** – Better handling of those situations where the admin switches from Multi-User to Sub-User mode after some orders have already been placed.
* **Improvement** – Improved user role assignment logic when creating new subaccounts in front end.
* **Improvement** – Word "password" is now translatable on `Edit Subaccount` page in front end.
* **Improvement** – Updated Freemius SDK to version 2.6.1.
* **Fix** – Fixed missing redirect to the first page of the order list after submitting the `Filter Orders / Select Subaccount Orders` form in frontend.
* **Tweak** – Removed "beta" warning from Multi-User option in backend.
* **Tweak** – Changed tooltip text for the options `Show subaccounts information on WooCommerce order page` and `Show subaccounts information on WooCommerce orders list page`.
* **Dev** – Store `_sfwc_order_placed_during_subaccount_mode` order meta value on order creation.
* **Dev** – Added helper function: `sfwc_order_placed_during_subaccount_mode` to determine if an order was placed while the plugin was in Sub-User or Multi-User mode (by passing $order_id).
* **Dev** – Pass additional argument `$parent_user_id` in `sfwc_frontend_after_add_subaccount_validation` hook.
* **Dev** – Added new hook: `sfwc_frontend_add_subaccount_form_before_fields`, to allow developers to add additional fields on frontend subaccount creation form.

= 1.4.3 =
*Release Date October 25, 2023*

* **Improvement** – User switcher now working also with persistent object cache enabled.
* **Improvement** – Always store `_sfwc_order_placed_by_user_id` order meta value, to provide better compatibility in case of switch from Sub-User to Multi-User mode and vice versa.
* **Fix** – Fixed `Order placed by` displaying incorrect information on front-end orders list page when the Manager places an order with Multi-User mode enabled.
* **Fix** – Fixed `Order placed by` displaying incorrect information on front-end order pages when the Manager places an order with Multi-User mode enabled.
* **Fix** – Fixed an issue where customers were unable to view certain orders on frontend when Multi-User mode is enabled.
* **Fix** – Fixed some translatability issues.

= 1.4.2 =
*Release Date September 5, 2023*

* **Improvement** – General improvement in the orders query on front end when Multi-User mode is enabled (e.g. include orders placed by subaccounts before multi-user mode was enabled).
* **Improvement** – Make the `Subaccount Info` meta box appear on back-end order pages when HPOS is enabled.
* **Improvement** – Updated Freemius SDK to version 2.5.12.
* **Fix** – Changed the URL of the order number links in the `Order` column on `Subaccount Orders` page.
* **Tweak** – Updated plugin icon on settings page.
* **Tweak** – Conditionally add `Pro` text next to the plugin title on the settings page in case the premium version of the plugin is active.

= 1.4.1 =
*Release Date August 5, 2023*

* **Fix** – Fixed undefined `selected_subaccount_orders_sanitized` on Orders page in frontend when Multi-User mode is enabled.
* **Fix** – Fixed undefined `current_user` on Edit Subaccount page in frontend.
* **Dev** – Added new hook: `sfwc_frontend_after_add_subaccount_validation`, to allow developers to save extra data on frontend subaccount creation.

= 1.4.0 =
*Release Date July 6, 2023*

* **New** – Ability for a parent account to edit its subaccounts directly from its *My Account* area, within the newly introduced `Manage Subaccounts` page.
* **New** – Multi-User mode [Beta feature].
* **Improvement** – Minor code improvements.
* **Improvement** – Updated Freemius SDK to version 2.5.10.
* **Fix** – Fixed some user queries that prevented users with custom roles from being visible.
* **Fix** – Prevented users with custom roles from appearing if their role is disabled in the plugin settings.
* **Fix** – Call the `save()` method in function `sfwc_store_subaccounts_meta_data_on_order_creation`.

= 1.3.0 =
*Release Date May 25, 2023*

* **New** – Possibility to limit the number of subaccounts that a parent account can create/add.
* **New** – Possibility to choose user roles (including custom ones) to enable the subaccount system for.
* **New** – Possibility to force subaccounts to inherit the billing/shipping address from their Manager (Subaccounts Pro required).
* **Improvement** – Ability for the Manager to filter subaccounts present in the user switcher dropdown menu.
* **Improvement** – Preserve Subaccount Orders search while selecting subaccount orders.
* **Improvement** – Updated Freemius SDK to version 2.5.8.
* **Tweak** – Moved `Options` tab before `Appearance` tab on plugin settings page.
* **Dev** – Added helper function: `sfwc_is_current_user_role_valid` to determine if current user role is eligible for the subaccount system.
* **Dev** – Added helper function: `sfwc_is_current_user_role_enabled` to determine if current user role is enabled from plugin settings.
* **Dev** – Added helper function: `sfwc_is_user_role_valid` to determine if user role is eligible for the subaccount system (by passing user ID).
* **Dev** – Added helper function: `sfwc_is_user_role_enabled` to determine if user role is enabled from plugin settings (by passing user ID).

= 1.2.1 =
*Release Date April 25, 2023*

* **Improvement** – Added `Account` column in Subaccount Orders page in front end.
* **Improvement** – Display `Account`, `Account type` and `Order placed by` information also in front-end order pages.
* **Improvement** – Minor CSS modifications in back-end users list to improve readability in case Subaccounts Pro is active.
* **Improvement** – Updated Freemius SDK to version 2.5.6.
* **Fix** – Honor `Customer Display Name` setting in "Order placed by" column in front end.
* **Tweak** – Minor text changes and corrections.

= 1.2.0 =
*Release Date March 20, 2023*

* **New** – Introduced support for the new WooCommerce High-Performance Order Storage (HPOS) feature.
* **Improvement** – Updated Freemius SDK to version 2.5.5.
* **Dev** – Replaced deprecated hook `woocommerce_my_account_my_orders_columns` with `woocommerce_account_orders_columns`.

= 1.1.4 =
*Release Date February 15, 2023*

* **Fix** – Restored function `sfwc_register_subaccounts_endpoint` to prevent endpoint returning `Not Found Error`.

= 1.1.3 =
*Release Date February 10, 2023*

* **New** – Added `Account` submenu item to show license activation status (`Subaccounts Pro` must be installed for the submenu item to appear).
* **Improvement** – Updated Freemius SDK to version 2.5.3.
* **Improvement** – Make sure the `session expired` notice appears in front end also if the parent account has switched to a subaccount.
* **Improvement** – Escaped some URLs before redirects are applied.
* **Fix** – Prevent `<ul>` tag from appearing twice in DOM on Subaccount Orders page in frontend.
* **Fix** – Prevent showing the Subaccounts Order form in case the logged in Manager has no subaccount.
* **Fix** – Fixed undefined `wp_button_class` on Subaccount Orders page in frontend after form is submitted.
* **Tweak** – Corrected typo in function name `sfwc_insert_subaccounts_endpoint_content`.
* **Tweak** – Modified some texts in the `Options` page in back end.
* **Removed** – Removed function `sfwc_add_subaccounts_query_vars`.
* **Removed** – Removed function `sfwc_register_subaccounts_endpoint`.

= 1.1.2 =
*Release Date December 5, 2022*

* **Improvement** – Make the user switcher pane appear immediately after the first subaccount is created for new accounts.
* **Improvement** – Prevent displaying the user switcher pane when only no longer existing subaccounts are present (e.g. subaccount users deleted by admin).
* **Fix** – Fixed undefined `already_children_existing` on Add Subaccount page in front end.

= 1.1.1 =
*Release Date November 1, 2022*

* **Fix** – Fixed undefined `sfwc_option_display_name` on Subaccount Orders page in front end.

= 1.1.0 =
*Release Date October 5, 2022*

* **New** – Possibility for a parent account to view subaccount orders directly from its *My Account* area.
* **Improvement** – Enqueue front-end scripts and styles only on *My Account* area.
* **Improvement** – Front-end subaccounts section splitted up in tabs.
* **Improvement** – Added a notice in back end in case a permalink settings update is required after plugin updates.
* **Improvement** – Updated Freemius SDK to version 2.4.5.
* **Fix** – Fixed WooCommerce custom endpoint returning `Not Found Error` in some cases.
* **Dev** – Defined two new PHP constants: `SFWC_CURRENT_VERSION` and `SFWC_REQUIRES_PERMALINK_UPDATE`.
* **Dev** – Store current plugin release information in `wp_options` table.

= 1.0.0 =
*Release Date June 25, 2022*

* Initial release.