There's already laws regulating warranty periods in every country. You'd need no extra laws at all. You just need to change them a bit, and in fact you can greatly simplify them.
Step 1. Warranty terms to be considerably extended. At least five years for any common thing, at least ten years...