So I just recently found out that with sub-races you add the racial ability modifier instead of replacing it but is that the same with variants or do you replace it if it is a variant?
Variant traits replace other traits
Sub-race traits add to the Main race traits, but Variant traits explicitly replace other traits.
Ex. Variant Human Traits:
If your campaign uses the optional feat rules from chapter 5, your Dungeon Master might allow these variant traits, all of which replace the human's Ability Score Increase trait.
All of the variants tell you which specific traits they replace, in this example you replace the Ability Score Increase trait (All ability scores increase by 1) with Ability Score Increase (2 different ability scores increase by 1), Skills (Proficiency with 1 skill), and Feat (You gain one feat).
Another example, Tieflings in "Sword Coast Adventurer's Guide" have a list of 5 different variants, each variant tells you exactly which trait it replaces (one of the variants doesn't replace anything, it's an addition).
Not all races have subraces, but if they do, its benefits (or drawbacks) are in addition to the parent race. Variants are an alternative (by definition), they replace something else.
For example, Half-Orcs don't have any subraces available, while Elves are subcategorized into High elves, Wood Elves and Drow (and probably also Eladrin once Mordenkainen's Tome of Foes is released).
Concerning variants, the most prominent example is the Variant Human (which also don't have subraces) - it replaces some of the traits of the original Human race and replaces them with something else.
Other available variants are the Half-Elf variants, SCAG p. 116, or the Tiefling variants, also SCAG, p. 118. I'm not aware of any other currently officially released variants, although there might be some in Unearthed Arcana or future releases.