It was quite an unproductive system. What if you didn’t find a pig owner who wanted chickens, but a cow, and a cow owner that wanted chickens? You could sell the chickens for the cow, then the cow for the pig. But what if the cow owner was in a different town and you had to travel there and back again?
People started using common goods used by almost everyone, also called commodities, as a basis for their exchanges: rice, mussels, seeds, salt. But these items were difficult to store or perishable.
So they turned to metal and started making coins. Metals were an excellent alternative: their value was generally accepted as they could be melted to be used for other purposes. This made comparing the cost (i.e. price) of different items possible.