Pry the little hub cap off the old wheel with a screwdriver and locate the cotter pin, the hairpin-like fastener that slides through a hole in the axle. Pull the cotter pin out with a pair of pliers. Count the washers that fill the space between the axle mount on the cart and the wheel -- there may also be a washer between the wheel and cotter pin -- because you will need to replace them to fit the new wheel.
Replace the washers on the axle between the cart and the wheel. If your replacement wheel is a different thickness than the original, you may need to subtract or add washers on this inner area.
Slide the wheel onto the axle and replace the washers between the wheel and cotter pin.
Insert the cotter pin partway into the hole in the axle so it can still be removed by hand. If the wheel wobbles or does not move easily, remove the cotter pin and add or remove washers so the wheel is stabilized but turns easily.
Tap the cotter pin through the axle to its seat when you complete fitting the washer. It must bridge the hole in the outside washer or wheel fitting. Replace the hub cap and push or tap it on.