Warning error on variation swatches
-
Hello,
I got this error on my product page, can you help me please it’s very urgent ..
“Warning: Invalid argument supplied for foreach() in /htdocs/wp-content/themes/basel/inc/classes/Swatches.php on line 129”
My customers can’t choose variations ..
Thanks,
Best regards.
I just added that in child theme, and the problem seems to be gone :
function woodmart_has_swatches( $id, $attr_name, $options, $available_variations, $swatches_use_variation_images = false ) {
$swatches = array();
foreach ($options as $key => $value) {
$swatch = woodmart_has_swatch($id, $attr_name, $value);
if( ! empty( $swatch ) ) {
if( $available_variations && $swatches_use_variation_images && woodmart_get_opt( 'grid_swatches_attribute' ) == $attr_name ) {
$variation = woodmart_get_option_variations( $attr_name, $available_variations, $value );
$swatch = array_merge( $swatch, $variation);
}
$swatches[$key] = $swatch;
}
}
return $swatches;
}
Can you confirm me ?
Hello,
We are glad you have solved the issue. If you have any questions please feel free to contact us.
Best Regards