Fix single product page extra fields in array format

This commit is contained in:
Pedro Silva 2023-08-11 16:09:11 +01:00
parent 75bbdb6635
commit 53bf234a4c
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 29 additions and 10 deletions

View file

@ -115,7 +115,11 @@ abstract class AbstractCartEndpoint implements EndpointInterface {
// Add extras to POST, they are usually added by custom plugins.
if ( $product['extra'] && is_array( $product['extra'] ) ) {
foreach ( $product['extra'] as $key => $value ) {
// Handle cases like field[]
$query = http_build_query( $product['extra'] );
parse_str( $query, $extra );
foreach ( $extra as $key => $value ) {
$_POST[ $key ] = $value;
}
}