Home Forums Plugins Product Importer Deluxe Support [Resolved] Help: Product Variations Reply To: Help: Product Variations

#10007
Anonymous
Inactive

You can try anywhere.

var_dump(false) -> print out false(boolean value)
var_dump(“false”) -> print out false(string value, this is not same like false in boolean value)

var_dump((bool)”any string, what I want”) -> print out true(because this string is retyped to boolean value and every non-empty string value after retype to boolean value return true).

And PHP in condition do exactly the same operation. It is not possible to compare different datatypes. So it is convert it to boolean value

So this
if( $product->is_variation && $product->is_variation != “false” )

is the same condition like this
if( $product->is_variation && $product->is_variation != (bool)”false” )

and this is the same condition like this
if( $product->is_variation && $product->is_variation != true )

So….the condition never return true