Skip to content

Commit 0276e8c

Browse files
authored
Merge pull request #39 from jeanmatthieud/fix-woocommerce-user-role
Change user role after creation to match WooCommerce
2 parents 4d88cd0 + 99db86f commit 0276e8c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

LabelStoreMax/lib/resources/pages/account_register.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ class _AccountRegistrationPageState extends NyState<AccountRegistrationPage> {
183183
username: username,
184184
),
185185
);
186+
187+
if (wpUserRegisterResponse?.data?.userToken != null) {
188+
await WPJsonAPI.instance.api((request) => request.wpUserAddRole(wpUserRegisterResponse!.data!.userToken, role: "customer"));
189+
await WPJsonAPI.instance.api((request) => request.wpUserRemoveRole(wpUserRegisterResponse!.data!.userToken, role: "subscriber"));
190+
}
186191
} on UsernameTakenException catch (e) {
187192
showToastNotification(context,
188193
title: trans("Oops!"),

0 commit comments

Comments
 (0)