Rename the amount labels on the product page (Variations drop-down menu)

WooCommerce has a hook that you can use to change labels for the dropdown menu. It is called woocommerce_variation_option_name

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 pw_gift_cards_woocommerce_variation_option_name( $name, $option_name, $attribute_name, $product_object ) {
    if ( is_a( $product_object, 'WC_Product_PW_Gift_Card' ) ) {
        $map = array(
            '$100.00' => 'Gold',
            '$500.00' => 'Diamond',
            '$1,000.00' => 'Platinum',
        );

        if ( isset( $map[ html_entity_decode( $name ) ] ) ) {
            return $map[ html_entity_decode( $name ) ];
        }
    }

    return $name;
}
add_filter( 'woocommerce_variation_option_name', 'pw_gift_cards_woocommerce_variation_option_name', 20, 4 );

If you want to rename the “Other Amount” option, follow the instructions in this guide:
https://www.pimwick.com/pw-faq/renaming-the-other-amount-option/

To change the amount that is displayed in the gift card email, see this guide:
https://www.pimwick.com/pw-faq/change-the-amount-on-the-gift-card-email/

Skip to content