Change the price range display

WooCommerce shows a price range to let the customer know the minimum and maximum price for the product.

If you have the PW Gift Cards Pro version, you can set the minimum and maximum for the Custom Amounts by editing the gift card product in your WooCommerce admin area. If you don’t allow custom amounts then the minimum and maximum will be the range of prices available.

WooCommerce will show the minimum and maximum for these types of products, however you can override it. To customize the price range text, follow these steps:

1. Download the free Code Snippets plugin https://wordpress.org/plugins/code-snippets/
2. Create a new Snippet with the following code:

function pwgc_variable_price_html( $price_html, $product ) {
    if ( $product->get_type() == 'pw-gift-card' ) {
        $price_html = 'Custom';
    }

    return $price_html;
}
add_filter( 'woocommerce_variable_sale_price_html', 'pwgc_variable_price_html', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'pwgc_variable_price_html', 10, 2 );

3. Change the ‘Custom’ value to whatever you would like to see.

Note: If you are more comfortable adding the code to your functions.php you can do that instead of using Code Snippets.

Skip to content