Hide the “View PDF” link on the frontend preview

Note: this requires the PW Gift Cards Pro version.

If you do not want to show the “View PDF” link when the purchasing customer previews the gift card email, follow these steps:

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code (you can optionally add this to your functions.php if you’re more familiar with that process instead.)

function custom_pwgc_email_css( $item_data ) {
    if ( property_exists( $item_data, 'preview' ) && $item_data->preview === true && isset( $_REQUEST['pwgc'] ) ) {
        echo '#pwgc-email-pdf-link-container { display: none; }';
    }
}
add_action( 'pwgc_email_css', 'custom_pwgc_email_css' );