Discount codes will not work for memberships that are set to bill in the future. At purchase, customers will initially be "charged" $0 to acknowledge the order, and discounts cannot be applied to $0. The customer will receive the actual membership charge on a specified start date or upon activation.
To ensure that customers who purchase the membership (billed at a later date) receive a discount, you can configure an automatic membership discount.
