What is a codpiece?
codpiece — is a detail of the cut of trousers, jeans, shorts or skirts, which is a placket that hides the front fastener.

Historically, this term denoted a distinct element of men's attire in the 15th and 16th centuries. At that time, a codpiece was a voluminous pouch or flap that was fastened to the chausses. It often served a decorative function and was additionally stuffed with fabric to give it shape.
In modern clothing, this detail serves a utilitarian function. The placket protects the fastener from mechanical damage, prevents skin or underwear from getting caught in the zipper teeth, and provides an aesthetically pleasing front.
Design and main types
The standard design consists of two main components. The first is the fly itself, an outer placket with slit loops or decorative stitching. The second is the fly flap, an inner placket to which buttons are attached or a second zipper tape is sewn.

The most common option for classic trousers and modern jeans is a zip fly. This design ensures the fabric fits as flat as possible across the stomach area.
Traditional denim and vintage styles often feature a button fly. A classic example is Levi's 501 jeans, which feature metal bolts instead of a zipper.
The front placket is visually decorated with single or double stitching. The shape of this line varies from strictly straight to rounded, depending on the style and density of the garment.
What to look for when choosing
Properly tailored trousers have a perfectly flat front placket. The fabric shouldn't bunch up, pull apart, or expose the zipper teeth when moved.

Button-down styles, due to the layering of fabric and metal hardware, can create additional volume in the lower abdominal area. This design feature is important to consider when choosing high-waist jeans.
The fly length directly depends on the waist height of the garment. High-rise trousers have a longer fly, while low-rise trousers have a shorter fly.

In designer collections, the fly often serves as a statement piece. Brands use contrast stitching, asymmetrical cuts, or exposed button fly buttons, transforming the functional part into a standalone decorative element.