This is necessary if you want your customers to select a size, colour or other attribute of a product before placing an order. Each attribute can be the same price, but you can make separate prices for some attributes.

Here are the steps in WooCommerce to  firstly creating attributes, then adding attributes and variations with prices to products.

Creating Attributes:
Woocommerce: Products: Attributes:
Add Name of attribute (e.g. Size)
Configure Terms: (e.g. Medium, Large, X Large, etc)

  1. Adding attributes to products:
    Edit Product: Product Data: Expand
    Change Product Data from Simple Product to Variable Product
    Click Attributes
    From Custom Product Attributes select Size
    Click Expand
    Select each one required or All ( Medium | Large | X Large etc.)
    Click Visible on the product page
    Click Used for variations
    Click Save Attributes
  2. Prices on variations:
    Click Variations
    Click Expand (to show each attribute)
    Add Regular Price to each Variation (and Sale price if any)
    Save Changes
  3. Update (Product)