If a retailer consumes a good he bought from the producer, does that get accounted into the GDP of a nation? Let's say we have a soft-drinks store. Say the store sells Pepsi and Coke. If the retailer drinks a bottle of coke from his own store, does that get counted into the GDP of a nation?

Or is it only counted if someone else apart from the store owner consumes it by paying for it?

How does this work?
Good question, which goes into the heart of the definition of GDP. 

The answer is that some of the value of the drink is accounted irrespective of what the seller does with the drink. Recall that GDP accounts for the value added of final goods, value which is "added" at each stage of production (and equivalent to the final price of the good). 

As such, when the retailer buys the can of coke from the wholesaler or producer, a portion of the total value has already been recorded in GDP. It is only the value added by the retailer which is not counted if the seller drinks the coke.

Naturally, this is true only if the seller does not sell the coke to herself. Otherwise it makes no difference at all.