Shaving cream is treated like a liquid and is subject to the TSA 3-1-1 liquids rule. This just means that any container of shaving cream must be no larger than 3.4 ounces and must be placed in a clear zip lock bag no larger than a quart to bring it as a carry-on.