Fixed Prices in Woocommerce

964 views Asked by At

I have a wordpress site with woocommerce installed, it is going to be a digital music store, and will have prices based on whether it is a single or mixtape. alot of people are going to be contributing to the site so it will be a nightmare if people enter the wrong price. does anyone know how to create:

  1. dropdown with fixed price options
  2. prices per product category
  3. or possibly some sort of filter that wont allow the product to be posted unless it is an allowed amount.

i havent found a solution (or maybe i havent been searching in the right places) i have a vague understanding of php. any help will be appreciated thanks.

1

There are 1 answers

6
helgatheviking On BEST ANSWER

You can filter the price via woocommerce_get_price.

An example:

function so_30998358_price( $price, $product ){
    if( has_term( 'expensive', 'product_cat', $product->id ) ){
        $price = 20;
    } else {
        $price = 10;
    }
    return $price;
}
add_filter( 'woocommerce_get_price', 'so_30998358_price', 10, 2 );