Move `??` operator from `get_source_values` back to `get_unprefixed_fields`

because `$_POST` may not include all these values.

Co-authored-by: Justin Palmer <228780+layoutd@users.noreply.github.com>
This commit is contained in:
Tomek Wytrębowicz 2023-11-24 16:07:31 +01:00 committed by Justin Palmer
parent 55b3ab1ec5
commit c28b0a9282
No known key found for this signature in database
GPG Key ID: ACAB7C35AA2577AF
1 changed files with 2 additions and 2 deletions

View File

@ -244,7 +244,7 @@ trait OrderAttributionMeta {
// Look through each field in POST data.
foreach ( $this->fields as $field ) {
$values[ $field ] = $raw_values[ $this->get_prefixed_field( $field ) ];
$values[ $field ] = $raw_values[ $this->get_prefixed_field( $field ) ] ?? '(none)';
}
return $values;
@ -262,7 +262,7 @@ trait OrderAttributionMeta {
// Look through each field in given data.
foreach ( $this->fields as $field ) {
$value = sanitize_text_field( wp_unslash( $raw_values[ $field ] ?? '(none)' ) );
$value = sanitize_text_field( wp_unslash( $raw_values[ $field ] ) );
if ( '(none)' === $value ) {
continue;
}