Skip to content
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.

Feature/avs 421 74 expand customer code options #120

Merged
merged 3 commits into from
Apr 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Framework/Interaction/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,13 @@ protected function retrieveCustomerCode($customer, $customerCode)
// A method exists with this getter name, call it
return $customer->{$getCustomerCode}();
}
// This was not a system-defined customer attribute, attempt to retrieve it as a custom attribute
return $customer->getCustomAttribute($customerCode)->getValue();
// This was not a system-defined customer attribute, retrieve it as a custom attribute
$attribute = $customer->getCustomAttribute($customerCode);
if (is_null($attribute)) {
// Retrieving the custom attribute failed, or no value was set, return null
return null;
}
// Return value of custom attribute
return $attribute->getValue();
}
}