Warranty costs

When you buy a product, unless you buy it on the flea market (where they have a rule “they gave it to me that way”), you get the right to warranty. By warranty, the manufacturer undertakes to repair or replace the damaged goods to another within the specified time period. Warranty is not something that is specifically bought, it comes with the product. How to calculate warranty costs?