Superconducting heterostructures: from antipinning to pinning potentials