diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php index 1113d5afab7249627d813b541f4e72a55e39d9bd..1e593ad6f9054f7f80cf83bf812f26eac0113242 100644 --- a/includes/rules_shipping_framework_woocommerce.php +++ b/includes/rules_shipping_framework_woocommerce.php @@ -306,19 +306,29 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { ); /* Get the user from the package information and extract further information about the buyer */ $user = $cart['user']; - // TODO: Extract user! -/** $data['company'] = isset($address['company'])?$address['company']:''; + $data['userid'] = $user['ID']; + if ($user['ID']>0) { + $userinfo = get_userdata($user['ID']); + $data['userroles'] = $userinfo->roles; + $data['username'] = $userinfo->user_login; + + $data['first_name'] = $userinfo->first_name; + $data['last_name'] = $userinfo->last_name; + + $data['email'] = isset($address['email'])?$address['email']:''; + // TODO: Extract more user fields! +/** + $data['company'] = isset($address['company'])?$address['company']:''; $data['title'] = isset($address['title'])?$address['title']:''; - $data['first_name'] = isset($address['title'])?$address['title']:''; $data['middle_name'] = isset($address['middle_name'])?$address['middle_name']:''; - $data['last_name'] = isset($address['last_name'])?$address['last_name']:''; $data['phone1'] = isset($address['phone_1'])?$address['phone_1']:''; $data['phone2'] = isset($address['phone_2'])?$address['phone_2']:''; $data['fax'] = isset($address['fax'])?$address['fax']:''; - $data['email'] = isset($address['email'])?$address['email']:''; */ + } // The country check needs the countryid variable, so duplicate from country: $data['countryid'] = $data['country']; + return $data; }