The gravitational force does 0 Joules of Work.
Work Step by Step
The cart starts and ends at the same height, therefore there is no displacement. Because gravity is only acting downwards the horizontal displacement is irrelevant. If no displacement is created, then no work was done.---Work=Displacement$\times$ Force Work=0m $\times$ Force Work= 0 Joules