Website Building » WooCommerce » How Do I Get Variation Price in WooCommerce?

How Do I Get Variation Price in WooCommerce?

Last updated on January 13, 2023 @ 12:14 pm

If you’re running a WooCommerce store, you’ve probably noticed that some products have a “variation” price. This is a price that’s different from the regular price of the product, and it’s usually used to indicate that the product is on sale.

So, how do you get variation prices in WooCommerce? It’s actually pretty simple:

PRO TIP: If you are using a WooCommerce theme that does not include variation pricing by default, you will need to add the following code to your theme’s functions.php file:

add_filter( ‘woocommerce_variation_prices_price’, ‘woocommerce_variation_prices_price’, 10, 2 );
function woocommerce_variation_prices_price( $price, $product ) {
// Get the product’s price
$product_price = get_post_meta( $product->id, ‘_price’, true );
// Get the product’s sale price
$product_sale_price = get_post_meta( $product->id, ‘_sale_price’, true );
// If sale price exists, use it instead of the product’s price
if ( ! empty( $product->sale_price ) ) {
$sale = true; // We’ll use this later on to style the price differently if on sale
$price = $product->sale_price; // Price with correct formatting
} else { // Otherwise just use the product’s regular price with correct formatting. Sale tag will be removed if on sale.

  1. First, go to the WooCommerce tab in your WordPress dashboard and click on Products. This will take you to the Products page, where you can see all of the products in your store.
  2. Next, find the product that you want to add a variation price to and click on its Edit link. This will take you to the Edit Product page for that product.
  3. On the Edit Product page, scroll down to the Product data section. In this section, you’ll see a tab for Variations. Click on this tab.
  4. On the Variations tab, you’ll see a list of all the variations for that product. Find the variation that you want to add a variation price to and click on its Edit link.
  5. On the Edit Variation page, scroll down to the Variation details section. In this section, you’ll see a field for “Regular price”. Enter the regular price for this variation in this field.
  6. Scroll down a bit further and you’ll see a field for “Sale price”. This is where you enter the variation price for this product. Enter the sale price in this field and then click on the “Update” button.

That’s it! You’ve now added a variation price to your product.

As you can see, it’s pretty easy to add variation prices in WooCommerce. Just follow the steps above and you’ll be able to add them in no time.

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.