... Skip to main content

Filter Hooks for Customizing Gift Card PDF Output

  1. Home
  2. Docs
  3. Gift Card for WooCommerce
  4. Custom hooks
  5. Filter Hooks
  6. Filter Hooks for Customizing Gift Card PDF Output

Filter Hooks for Customizing Gift Card PDF Output

The Gift Card for WooCommerce plugin allows developers to customize the gift card heading and description dynamically using WordPress filter hooks. These filters are applied during the PDF generation process via the function wodgc_generate_giftcard_pdf()

🧩 Available Filters


1. wodgc_default_giftcard_heading

Location:
Inside the wodgc_generate_giftcard_pdf() function, applied when retrieving the gift card heading for the PDF.

Purpose:
Use this filter to modify the default heading displayed on the generated gift card PDF when no custom heading is saved in the gift card metadata.

Hook Application:

phpCopyEdit$giftcard_heading = apply_filters( 'wodgc_default_giftcard_heading', $giftcard_heading, $gift_code );

Hook Registration:

phpCopyEditadd_filter( 'wodgc_default_giftcard_heading', 'wodgc_custom_giftcard_heading', 10, 2 );

Function Example:

phpCopyEditfunction wodgc_custom_giftcard_heading( $heading, $gift_code ) {
// Return a custom heading for the gift card
}

2. wodgc_default_giftcard_description

Location:
Inside the wodgc_generate_giftcard_pdf() function, applied when retrieving the short message or note for the PDF.

Purpose:
Use this filter to modify the default short description shown in the generated gift card PDF when no custom message is saved.

Hook Application:

phpCopyEdit$short_description = apply_filters( 'wodgc_default_giftcard_description', $short_description, $gift_code );

Hook Registration:

phpCopyEditadd_filter( 'wodgc_default_giftcard_description', 'wodgc_custom_giftcard_description', 10, 2 );

Function Example:

phpCopyEditfunction wodgc_custom_giftcard_description( $description, $gift_code ) {
// Return a custom description for the gift card
}

How can we help?