SUMMARY The iconic Sonic Hedgehog (SHH) morphogen pathway is a fundamental orchestrator of embryonic development and stem cell maintenance, and is implicated in cancers in various organs. A key step in signalling is transfer of a palmitate group to the N-terminal cysteine residue of SHH, catalysed by the multi-pass transmembrane enzyme Hedgehog acyltransferase (HHAT) resident in the endoplasmic reticulum (ER). Here, we present the high-resolution cryo-EM structure of HHAT bound to substrate analogue palmityl-coenzyme A and a SHH mimetic megabody. Surprisingly, we identified a heme group bound to an HHAT cysteine residue and show that this modification is essential for HHAT structure and function. A structure of HHAT bound to potent small molecule inhibitor IMP-1575 revealed conformational changes in the active site which occlude substrate binding. Our multidisciplinary analysis provides a detailed view of the novel mechanism by which HHAT adapts the membrane environment to transfer a long chain fatty acid across the ER membrane from cytosolic acyl-CoA to a luminal protein substrate. This structure of a member of the protein-substrate membrane-bound O-acyltransferase (MBOAT) superfamily provides a blueprint for other protein substrate MBOATs, such as WNT morphogen acyltransferase Porcupine and ghrelin O -acyltransferase GOAT, and a template for future drug discovery.