Fertilizer prices are rising in part because ammonia production is a rather energy intensive process and the price of natural gas used to produce ammonia is way up due to war time shortages. Ammonia, of course, is the primary source material for nitrogen based fertilizers.
The production of fertilizers such as ammonium nitrate and urea require ammonia. Ammonia is synthesized on large scales with the Haber-Bosch process. This process requires hydrogen, which is obtained by steam reforming of methane in natural gas.
When natural gas prices exploded in Europe, many fertilizer factories had to stop production:
Supply chain issues, logistics problems, and high demand lead to rising prices which lead the largest exporter of phosphate fertilizer, China, to halt exports to protect domestic supply. Russia is the biggest exporter of potassium fertilizer.
I would suggest that fertilizer prices are higher due to cost increases to manufacture them but also because grain prices are higher. There seems to be a relationship between the 2 which is independent of actual costs to manufacture the inputs. As grain prices increase input costs increase, likewise with the inverse, grain prices decrease input prices decrease. Supply and demand for sure but there seems to be market forces outside of simply supply vs demand.