Fixed bug #5902: Variants can't be deactivated

Checkbox logic should be done before checking if something was changed in variants.