The gift card won’t be tied to specific products, however you can change the label to indicate what the gift card can purchase. WooCommerce has a hook that you can use to change labels for the dropdown menu. It is called woocommerce_variation_option_name
You could then map the current value to the name you want to see. For example:
1. Download the functions.php from your FTP server at /wp-content/themes/<your theme>/functions.php
2. Keep a backup of functions.php in case there are problems.
3. Edit functions.php and scroll to the very end and add this code.
Note: if the last line is “?>” then put this code *above* that line. Otherwise, this code goes at the very end of the file:
function pw_gift_cards_woocommerce_variation_option_name( $name ) {
global $product;
if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
$map = array(
'£10' => '£10 – one month subscription',
'£30' => '£30 – one month subscription',
'£120' => '£120 – one month subscription',
);
if ( isset( $map[$name] ) ) {
return $map[$name];
}
}
return $name;
}
add_filter( 'woocommerce_variation_option_name', 'pw_gift_cards_woocommerce_variation_option_name', 10, 2 );
4. Save the functions.php file and re-upload it to your server.
Replace functions.php with your backup file if you have any problems.
The customer who receives the gift card can purchase a higher subscription and use another payment method to cover the difference.