From 351a00b0f03742bfceb943575a89109c020982df Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Fri, 14 May 2021 15:30:17 +0530 Subject: [PATCH 1/7] Add Smart smart commission field, PFWMA-229 --- ...oocommerce-multi-account-management-admin.php | 16 ++++++++++++++++ ...woocommerce-multi-account-management-admin.js | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index a11f766..929adaf 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -609,6 +609,8 @@ public function angelleye_multi_account_settings_fields() { } $angelleye_payment_load_balancer = !empty($_POST['angelleye_payment_load_balancer']) ? $_POST['angelleye_payment_load_balancer'] : ''; update_option('angelleye_payment_load_balancer', wc_clean($angelleye_payment_load_balancer)); + $angelleye_smart_commission = !empty($_POST['angelleye_smart_commission']) ? $_POST['angelleye_smart_commission'] : ''; + update_option('angelleye_smart_commission', wc_clean($angelleye_smart_commission)); $this->message = __('Your settings have been saved.', 'paypal-for-woocommerce-multi-account-management'); if(!empty($angelleye_payment_load_balancer)) { $disable_trigger_account = $this->angelleye_disable_always_trigger_accounts(); @@ -625,6 +627,7 @@ public function angelleye_multi_account_settings_fields() { $global_automatic_rule_creation_enable = get_option('global_automatic_rule_creation_enable', ''); $global_automatic_rule_creation_testmode = get_option('global_automatic_rule_creation_testmode', ''); $angelleye_payment_load_balancer = get_option('angelleye_payment_load_balancer', ''); + $angelleye_smart_commission = get_option('angelleye_smart_commission', ''); $global_ec_include_tax_shipping_in_commission = get_option('global_ec_include_tax_shipping_in_commission', ''); ?>
@@ -647,6 +650,19 @@ public function angelleye_multi_account_settings_fields() { + + + + + +
+ +

+ +

+
+ + diff --git a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js index 1c9b9a9..07ece9c 100644 --- a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js +++ b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js @@ -60,6 +60,15 @@ function angelleye_multi_account_choose_payment_hide_show_field() { } jQuery('#angelleye_payment_load_balancer').change(function () { + if (jQuery(this).is(':checked')) { + jQuery('.angelleye_multi_account_paypal_express_field').hide(); + jQuery('.angelleye_smart_commission_tr').hide(); + } else { + jQuery('.angelleye_multi_account_paypal_express_field').show(); + jQuery('.angelleye_smart_commission_tr').show(); + } +}).change(); +jQuery('#angelleye_smart_commission').change(function () { if (jQuery(this).is(':checked')) { jQuery('.angelleye_multi_account_paypal_express_field').hide(); } else { From 650d2746302bc03f3b0ff283affd0351b5fc2718 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Fri, 14 May 2021 15:53:21 +0530 Subject: [PATCH 2/7] Hide show fields using jQuery, PFWMA-229 --- ...ommerce-multi-account-management-admin.php | 6 +++--- ...commerce-multi-account-management-admin.js | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index 929adaf..afd71ce 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -663,7 +663,7 @@ public function angelleye_multi_account_settings_fields() { - + @@ -673,7 +673,7 @@ public function angelleye_multi_account_settings_fields() { - + @@ -683,7 +683,7 @@ public function angelleye_multi_account_settings_fields() { - + diff --git a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js index 07ece9c..bec8b1c 100644 --- a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js +++ b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js @@ -61,18 +61,25 @@ function angelleye_multi_account_choose_payment_hide_show_field() { jQuery('#angelleye_payment_load_balancer').change(function () { if (jQuery(this).is(':checked')) { - jQuery('.angelleye_multi_account_paypal_express_field').hide(); - jQuery('.angelleye_smart_commission_tr').hide(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr').hide(); } else { - jQuery('.angelleye_multi_account_paypal_express_field').show(); jQuery('.angelleye_smart_commission_tr').show(); + if (jQuery('#angelleye_smart_commission').is(':checked')) { + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').hide(); + } else { + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').show(); + } } }).change(); jQuery('#angelleye_smart_commission').change(function () { - if (jQuery(this).is(':checked')) { - jQuery('.angelleye_multi_account_paypal_express_field').hide(); + if(jQuery('#angelleye_payment_load_balancer').is(':checked')) { + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr').hide(); } else { - jQuery('.angelleye_multi_account_paypal_express_field').show(); + if (jQuery(this).is(':checked')) { + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').hide(); + } else { + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').show(); + } } }).change(); From 3b63554369b634db1281a71f8f3f0ebe31cae6c7 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Thu, 20 May 2021 03:34:06 -0700 Subject: [PATCH 3/7] Add Smart commission UI, PFWMA-229 --- ...ommerce-multi-account-management-admin.php | 111 +++++++++++++++++- ...commerce-multi-account-management-admin.js | 15 ++- 2 files changed, 119 insertions(+), 7 deletions(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index 4079cb1..ed22436 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -464,7 +464,7 @@ public function angelleye_display_multi_account_list() { } $option_fourteen .= ''; - + $option_fifteen_one = ''; if (wc_shipping_enabled()) { $option_fifteen_one = '

' . __('Shipping Zones', 'paypal-for-woocommerce-multi-account-management') . '

'; @@ -478,7 +478,7 @@ public function angelleye_display_multi_account_list() { } $option_fifteen_one .= ''; } - + $option_fifteen = ''; if (wc_shipping_enabled()) { $option_fifteen = '

' . __('Shipping Class', 'paypal-for-woocommerce-multi-account-management') . '

'; @@ -622,6 +622,7 @@ public function angelleye_display_multi_account_list() { } public function angelleye_multi_account_settings_fields() { + $GLOBALS['hide_save_button'] = true; $disable_trigger_account = 0; if (!empty($_POST['global_commission_microprocessing_save'])) { update_option('global_ec_site_owner_commission', wc_clean($_POST['global_ec_site_owner_commission'])); @@ -635,7 +636,19 @@ public function angelleye_multi_account_settings_fields() { $angelleye_payment_load_balancer = !empty($_POST['angelleye_payment_load_balancer']) ? $_POST['angelleye_payment_load_balancer'] : ''; update_option('angelleye_payment_load_balancer', wc_clean($angelleye_payment_load_balancer)); $angelleye_smart_commission = !empty($_POST['angelleye_smart_commission']) ? $_POST['angelleye_smart_commission'] : ''; + $temp_role = array(); + if(!empty($angelleye_smart_commission['role'])) { + foreach ($angelleye_smart_commission['role'] as $ro_key => $ro_value) { + if (array_key_exists($ro_value,$temp_role)) { + unset($angelleye_smart_commission['commission'][$ro_key]); + unset($angelleye_smart_commission['role'][$ro_key]); + } else { + $temp_role[$ro_value] = $ro_value; + } + } + } update_option('angelleye_smart_commission', wc_clean($angelleye_smart_commission)); + $this->message = __('Your settings have been saved.', 'paypal-for-woocommerce-multi-account-management'); if (!empty($angelleye_payment_load_balancer)) { $disable_trigger_account = $this->angelleye_disable_always_trigger_accounts(); @@ -657,7 +670,7 @@ public function angelleye_multi_account_settings_fields() { ?>
diff --git a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js index bec8b1c..21b66e3 100644 --- a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js +++ b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js @@ -193,7 +193,10 @@ jQuery('.disable_all_vendor_rules').on('click', function (event) { return r; } }); - +jQuery( "#angelleye_multi_account_global_setting" ).submit(function( event ) { + window.onbeforeunload = null; + jQuery('angelleye_multi_account_global_setting').sumit(); +}); jQuery( "#angelleye_multi_account" ).submit(function( event ) { window.onbeforeunload = null; if(jQuery("#is_force_submit").val() === 'yes') { @@ -252,7 +255,6 @@ jQuery('.enable_all_vendor_rules').on('click', function (event) { return r; } }); - jQuery('.create_all_vendor_rules').on('click', function (event) { var r = confirm(pfwma_param.create_all_vendor_rules_alert_message); if (r == true) { @@ -277,3 +279,12 @@ jQuery('.create_all_vendor_rules').on('click', function (event) { return r; } }); +jQuery('.angelleye_add_new_smart_commission_role').on('click', function (event) { + event.preventDefault(); + var $tableBody = jQuery('#angelleye_smart_commission_table').find("tbody"), + $trLast = $tableBody.find("tr:last"), + $trNew = $trLast.clone(); + $trNew.find( 'input' ).val( '' ); + $trNew.find("option").prop("selected", false).trigger( "change" ); + $trLast.after($trNew); +}); From 94c5855e19109376362e1db13847875bf8fe76cf Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Thu, 20 May 2021 04:49:49 -0700 Subject: [PATCH 4/7] Add Smart commission UI, PFWMA-229 --- ...ommerce-multi-account-management-admin.php | 90 +++++++++++++------ ...ommerce-multi-account-management-admin.css | 13 ++- ...commerce-multi-account-management-admin.js | 26 ++++-- 3 files changed, 88 insertions(+), 41 deletions(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index ed22436..cf6d4dd 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -639,11 +639,18 @@ public function angelleye_multi_account_settings_fields() { $temp_role = array(); if(!empty($angelleye_smart_commission['role'])) { foreach ($angelleye_smart_commission['role'] as $ro_key => $ro_value) { - if (array_key_exists($ro_value,$temp_role)) { + if(!empty($angelleye_smart_commission['commission'][$ro_key]) && !empty($angelleye_smart_commission['role'][$ro_key]) && !empty($angelleye_smart_commission['item_label'][$ro_key])) { + if (array_key_exists($ro_value,$temp_role)) { + unset($angelleye_smart_commission['commission'][$ro_key]); + unset($angelleye_smart_commission['role'][$ro_key]); + unset($angelleye_smart_commission['item_label'][$ro_key]); + } else { + $temp_role[$ro_value] = $ro_value; + } + } else { unset($angelleye_smart_commission['commission'][$ro_key]); unset($angelleye_smart_commission['role'][$ro_key]); - } else { - $temp_role[$ro_value] = $ro_value; + unset($angelleye_smart_commission['item_label'][$ro_key]); } } } @@ -688,6 +695,22 @@ public function angelleye_multi_account_settings_fields() { + + + + + +
+ +

+ +

+
+ + @@ -721,27 +744,12 @@ public function angelleye_multi_account_settings_fields() { - - - - - -
- -

- -

-
- - + - +
- +
@@ -751,18 +759,24 @@ public function angelleye_multi_account_settings_fields() {
-
+
- +
+ + @@ -781,7 +795,13 @@ public function angelleye_multi_account_settings_fields() { + + + + + + diff --git a/admin/css/paypal-for-woocommerce-multi-account-management-admin.css b/admin/css/paypal-for-woocommerce-multi-account-management-admin.css index 2ee51c5..0421c26 100644 --- a/admin/css/paypal-for-woocommerce-multi-account-management-admin.css +++ b/admin/css/paypal-for-woocommerce-multi-account-management-admin.css @@ -84,7 +84,7 @@ } .notice.notice-success.angelleye-notice { font: 13px "Open Sans", sans-serif; - line-height: normal; + line-height: normal; } .angelleye-notice-message { color: #23282D; @@ -175,11 +175,16 @@ fieldset.pfwma_section_ui legend { .angelleye_multi_account_left table.form-table th label { min-width: 200px; } +td a.angelleye_smart_commission_delete { + color: #a00; + cursor: pointer; +} + @media screen and (max-width: 782px) { .angelleye_multi_account_left { - max-width: 100% !important; - width: 100%; - + max-width: 100% !important; + width: 100%; + } .micro_account_fields { max-width: 100% !important; diff --git a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js index 21b66e3..f5fcff5 100644 --- a/admin/js/paypal-for-woocommerce-multi-account-management-admin.js +++ b/admin/js/paypal-for-woocommerce-multi-account-management-admin.js @@ -61,28 +61,38 @@ function angelleye_multi_account_choose_payment_hide_show_field() { jQuery('#angelleye_payment_load_balancer').change(function () { if (jQuery(this).is(':checked')) { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr').hide(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr, .angelleye_smart_commission_tt').hide(); } else { - jQuery('.angelleye_smart_commission_tr').show(); + jQuery('.angelleye_smart_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').show(); if (jQuery('#angelleye_smart_commission').is(':checked')) { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').hide(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr').hide(); + jQuery('.angelleye_smart_commission_tt').show(); } else { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').show(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr').show(); + jQuery('.angelleye_smart_commission_tt').hide(); } } }).change(); jQuery('#angelleye_smart_commission').change(function () { if(jQuery('#angelleye_payment_load_balancer').is(':checked')) { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr').hide(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr, .angelleye_smart_commission_tr, .angelleye_smart_commission_tt').hide(); } else { if (jQuery(this).is(':checked')) { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').hide(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr').hide(); + jQuery('.angelleye_smart_commission_tt').show(); } else { - jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr, .global_ec_include_tax_shipping_in_commission_tr').show(); + jQuery('.global_ec_site_owner_commission_label_tr, .global_ec_site_owner_commission_tr').show(); + jQuery('.angelleye_smart_commission_tt').hide(); } } }).change(); - +jQuery(document).on('click', 'td a.angelleye_smart_commission_delete', function () { + if (!confirm("Do you want to delete?")) { + return false; + } else { + jQuery(this).closest("tr").remove(); + } +}); jQuery('.angelleye_multi_account_choose_payment_gateway').change(function () { angelleye_multi_account_choose_payment_hide_show_field(); if (jQuery('.angelleye_multi_account_choose_payment_gateway').val() === 'paypal_pro_payflow') { From 922208d229b8046ea0842a40bb0d4ff175552ed7 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Thu, 20 May 2021 05:37:46 -0700 Subject: [PATCH 5/7] Add Smart commission Logic, PFWMA-229 --- ...ount-management-admin-express-checkout.php | 28 +++++++++++++++++-- ...ommerce-multi-account-management-admin.php | 21 ++++++++++---- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php index 75f3876..f1ba786 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php @@ -76,8 +76,32 @@ public function __construct($plugin_name, $version) { $this->map_item_with_account = array(); $this->is_commission_enable = false; $this->divided_shipping_cost = 0; - $this->global_ec_site_owner_commission = get_option('global_ec_site_owner_commission', 0); - $this->global_ec_site_owner_commission_label = get_option('global_ec_site_owner_commission_label', ''); + $angelleye_smart_commission = get_option('angelleye_smart_commission', ''); + $this->global_ec_site_owner_commission = 0; + $this->global_ec_site_owner_commission_label = ''; + if(isset($angelleye_smart_commission['enable']) && $angelleye_smart_commission['enable'] == 'on') { + if (is_user_logged_in() && !empty($angelleye_smart_commission['role'])) { + $customer_id = get_current_user_id(); + $user = new WP_User($customer_id); + if (!empty($user->roles) && is_array($user->roles)) { + foreach ($angelleye_smart_commission['role'] as $ro_key => $ro_value) { + if($user->roles === $ro_value) { + $this->global_ec_site_owner_commission = $angelleye_smart_commission['commission'][$ro_key]; + $this->global_ec_site_owner_commission_label = $angelleye_smart_commission['item_label'][$ro_key]; + } + } + } + if(empty($this->global_ec_site_owner_commission_label)) { + if( isset($angelleye_smart_commission['regular_smart_commission']) ) { + $this->global_ec_site_owner_commission = $angelleye_smart_commission['regular_smart_commission']; + $this->global_ec_site_owner_commission_label = $angelleye_smart_commission['regular_smart_commission_item_label']; + } + } + } + } else { + $this->global_ec_site_owner_commission = get_option('global_ec_site_owner_commission', 0); + $this->global_ec_site_owner_commission_label = get_option('global_ec_site_owner_commission_label', ''); + } $this->global_ec_include_tax_shipping_in_commission = get_option('global_ec_include_tax_shipping_in_commission', ''); $is_zdp_currency = in_array(get_woocommerce_currency(), $this->zdp_currencies); if ($is_zdp_currency) { diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php index cf6d4dd..a2d9fd6 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin.php @@ -758,12 +758,23 @@ public function angelleye_multi_account_settings_fields() { + + + +
- User Role + + + + + - Commission Rate % +
- + + + + +
- + + + + +
- User Role + + + + + - Commission Rate % +
+ + +
+ +
+ +
-
-
+
+
- +
@@ -798,7 +809,7 @@ public function angelleye_multi_account_settings_fields() { - + @@ -828,7 +839,7 @@ public function angelleye_multi_account_settings_fields() { - + From 691fbde7169048f8c6d63ab22dacec1c81fa3812 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Sun, 23 May 2021 22:34:14 -0700 Subject: [PATCH 6/7] Update Smart commission Logic, PFWMA-229 --- ...multi-account-management-admin-express-checkout.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php index f1ba786..86cab81 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php @@ -91,11 +91,11 @@ public function __construct($plugin_name, $version) { } } } - if(empty($this->global_ec_site_owner_commission_label)) { - if( isset($angelleye_smart_commission['regular_smart_commission']) ) { - $this->global_ec_site_owner_commission = $angelleye_smart_commission['regular_smart_commission']; - $this->global_ec_site_owner_commission_label = $angelleye_smart_commission['regular_smart_commission_item_label']; - } + } + if(empty($this->global_ec_site_owner_commission_label)) { + if( isset($angelleye_smart_commission['regular_smart_commission']) ) { + $this->global_ec_site_owner_commission = $angelleye_smart_commission['regular_smart_commission']; + $this->global_ec_site_owner_commission_label = $angelleye_smart_commission['regular_smart_commission_item_label']; } } } else { From 51ef1b1f04b175a8d3240e7a805c77a9af1b0023 Mon Sep 17 00:00:00 2001 From: kcppdevelopers Date: Mon, 24 May 2021 02:55:29 -0700 Subject: [PATCH 7/7] Update Smart commission Logic, PFWMA-229 --- ...commerce-multi-account-management-admin-express-checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php index 86cab81..2737e97 100644 --- a/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php +++ b/admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php @@ -85,7 +85,7 @@ public function __construct($plugin_name, $version) { $user = new WP_User($customer_id); if (!empty($user->roles) && is_array($user->roles)) { foreach ($angelleye_smart_commission['role'] as $ro_key => $ro_value) { - if($user->roles === $ro_value) { + if (in_array($ro_value, (array) $user->roles, true)) { $this->global_ec_site_owner_commission = $angelleye_smart_commission['commission'][$ro_key]; $this->global_ec_site_owner_commission_label = $angelleye_smart_commission['item_label'][$ro_key]; }