How do I create a discount code which can be used on auto-charging subscription orders?

To create a discount code which can be used on auto-charging subscription products, just go to your Shopify Admin -> Discounts -> create new discount code. In the "Purchase Type" configuration, select either "Subscription" option or the "Both" option.