Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds isset() and is_array() to check for clean data, resolves PFWMA-294 #114

Merged
merged 1 commit into from
Feb 23, 2023
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
18 changes: 15 additions & 3 deletions includes/angelleye-multi-account-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,27 @@ function angelleye_display_checkout_custom_field() {
'account' => array('account_username', 'account_password', 'account_password-2'),
'order' => array('order_comments')
);

$checkout_fields = WC()->checkout->get_checkout_fields();
$woo_custome_fields = array();

/**
* Adds isset() and is_array() to avoid errors when the data is not a clean array.
* Resolves PFWMA-294
* [email protected]
*/
foreach ($checkout_fields as $type => $checkout_field) {
foreach ($checkout_field as $key => $field) {
if (!in_array($key, $woo_checkout_default_fields[$type])) {
$woo_custome_fields[$key] = $field;
if (isset($woo_checkout_default_fields[$type]) && is_array($woo_checkout_default_fields[$type])) {
foreach ($checkout_field as $key => $field) {
if (!in_array($key, $woo_checkout_default_fields[$type])) {
$woo_custome_fields[$key] = $field;
}
}
}
}

return $woo_custome_fields;

}

function angelleye_get_checkout_custom_field_keys() {
Expand Down