Because in the history of barter - gold and silver have always been traded and have never been worth zero.
There are plenty of other things to barter too.
If we’re trading gold and silver, then we have a monetary system, not a strict barter economy. The definition of money is, “A medium of exchange, or a store of value,” independent of the item’s practical use. Gold and silver have some practical uses, but those will be no more relevant in a total economic collapse situation than will be the decorative value of cowrie shell.