Technically, it is possible to trademark a shape under specific circumstances. You might already be familiar with some well-known brands that hold a shape registration, such as the Coca-Cola bottle shape, the Toblerone chocolate bar shape, or the Hershey's chocolate Kisses.
However, you must meet a couple of requirements for the registration to succeed. Generally, for a shape to get trademark protection, it must be distinctive apart from its technical purposes.
To look at some examples, the EU Trademark Directive states that shapes can gain trademark protection, although the shape cannot exclusively reflect the nature of the product in question. Section 45 of the Lanham Act of the US code asserts that a symbol used in commerce under which a certain product can be fully distinguished can be registered as a trademark.