Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Check if variation data is iterable before formatting (#4182)
Browse files Browse the repository at this point in the history
  • Loading branch information
opr authored and grogou committed Aug 20, 2021
1 parent 4279db8 commit 556ceb4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/StoreApi/Schemas/CartItemSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ protected function get_remaining_stock( \WC_Product $product ) {
protected function format_variation_data( $variation_data, $product ) {
$return = [];

if ( ! is_iterable( $variation_data ) ) {
return $return;
}

foreach ( $variation_data as $key => $value ) {
$taxonomy = wc_attribute_taxonomy_name( str_replace( 'attribute_pa_', '', urldecode( $key ) ) );

Expand Down

0 comments on commit 556ceb4

Please sign in to comment.