To create a discount code, click Studio set-up > Discount codes > Create
Name it, and then choose:
Discount type: if its a percentage off or fixed value off
Usage Limit: whether it will be limited to one use per person (or more)
Auto-renewing subscriptions limit: if this code be applicable to subscriptions, how many renewals will it be limited to (note: on the next page, you can assign which items it will be usable on)
Expiration: will it expire? If so, add the date. If not, leave it blank
Applies to: Does it apply to everything? Or just specific items. You'll be able to fine tune which items on the following page.
Click 'Create' when you're done (note that if you chose Specific Items you'll need to locate the discount code in the index page, click it and assign the specific categories/items).
To assign items, choose categories, the assign items.