You get 3/7 times of the available loot if your clan loses the war.
For a Victory you would earn the full War Win bonus. For a draw you would earn half of the war win bonus, and for a Defeat you would earn only 3/7ths of the war win bonus. As of the newest 2018 update states.
The 'war win bonus' is rewarded in full to you and then the percentage above is applied.
So if you obtained a bonus of 700k gold, you would get 700k gold no matter how many stars you scored if your clan wins. You'd get 350k gold if your clan draws and 300k gold otherwise.
You get 40% of the available loot if your clan loses the war.
For a Victory you would earn the full War Win bonus. For a draw you would earn half of the war win bonus, and for a Defeat you would earn only 3/7ths of the war win bonus. As of the newest 2017 update states.
Though there's one thing I want to clear up: the 'war win bonus' is rewarded in full to you and then the percentage above is applied. The number of stars you get on a base has no influence on this. Source is personal experience. I have 'town hall sniped' (which gives 1 star) a lot of times just because of this because my clan was winning the war by far and the other clan was mostly inactive so chances that they catch up was close to nil and I really needed resources for major upgrades. So whenever a clan is inactive attack straight away. Otherwise I would advise you to let them attack first.
So if you have a bonus of 100k gold, you would get 100k gold no matter how many stars you scored if your clan wins. You'd get 70k gold if your clan draws and 40k gold otherwise, all this irrespective of the number of stars you scored.
Note that if you score no stars, you won't get any bonus (the bonus won't appear at the top left of your screen).