Set shader's AlphaCutoff programmatically in HDRP

I’ve changed _AlphaCutoff for HDRP/Lit via C# like so:

    Material output;
    output.SetFloat("_AlphaCutoffEnable", alpha_threshold);
    output.SetFloat("_AlphaCutoff", alpha_threshold);
    output.SetFloat("_AlphaCutoffShadow", alpha_threshold);

Hit play and the cutoff doesn’t work, however instantly upon clicking the material in the inspector (while still running in play mode), the cutoff sorts itself out and falls into effect. Apparently this is a known issue:

So I added the lines from the link above.

    output.SetFloat("_Cutoff", alpha_threshold);
    output.SetOverrideTag("RenderType", "TransparentCutout");
    output.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
    output.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
    output.SetInt("_ZWrite", 1);
    output.EnableKeyword("_ALPHATEST_ON");
    output.DisableKeyword("_ALPHABLEND_ON");
    output.DisableKeyword("_ALPHAPREMULTIPLY_ON");
    output.renderQueue = 2450;

Still doesn’t work with the new HDRP. Anyone know the alternative?

Figured it out. Unity deprecated keywords like _ALPHATEST_ON in favor of enums. Anyway shaders are icky so I don’t know how much of this is important but here’s everything I added.

    output.SetFloat("_BlendMode", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
    output.SetFloat("_ZTestGBuffer", 3);
    output.SetFloat("_ZTestModeDistortion", 4);
    output.SetFloat("_ZTestDepthEqualForOpaque", 3);

And now setting alpha cutoff for a material using HDRP/Lit during runtime works without having to touch the inspector.