Home Forums Basel support forum Warning error on variation swatches

Warning error on variation swatches

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #190063

    Ozan51
    Participant

    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.

    #190068

    Ozan51
    Participant

    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 ?

    #190103

    Hello,

    We are glad you have solved the issue. If you have any questions please feel free to contact us.

    Best Regards

Viewing 3 posts - 1 through 3 (of 3 total)