Skip to content

Commit 99db86f

Browse files
committed
Change user role after creation to match WooCommerce
1 parent faa62bb commit 99db86f

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)