• Skip to primary navigation
  • Skip to main content
LogoMain
WP Desk

WP Desk

WooCommerce Plugins

Flexible Invoices

Flexible Invoices

Automate invoicing

ShopMagic

ShopMagic

E-mail automations

Flexible Coupons

  • Pricing
  • Add-ons
  • Docs
  • Support
  • Blog
  • Ideas
  • My Account
How to customize WooCommerce PDF Coupons with custom fonts – case study

Published: 2025-07-14 / Updated: 2026-10-18 / Blog

How to customize WooCommerce PDF Coupons with custom fonts – case study

Krzysztof Skorupa

Professional WooCommerce PDF coupons should reflect the same visual identity as your website, packaging, and marketing materials. In this case study, we show how custom PHP filters in Flexible PDF Coupons PRO were used to add a brand font to the coupon editor and make it available when generating PDF gift cards, vouchers, and tickets.

WooCommerce PDF coupon design and the need for consistent branding

A client using our plugin to generate WooCommerce PDF coupons needed the finished documents to follow their brand guidelines more closely. The drag-and-drop editor simplified template creation, but the project introduced two specific requirements:

  1. Replace the available sans-serif typefaces with serif and display fonts consistent with the brand.
  2. Use a font size beyond the 72 px limit available in the editor.

The client selected Playfair Display SC and League Spartan. To extend the available typography options, we used the filters provided by Flexible PDF Coupons PRO. This approach made the font available both in the template editor and to the PDF generation engine.

This case study covers an advanced, code-based customization for Flexible PDF Coupons PRO. Add PHP snippets only if you are comfortable editing WordPress functionality, and test the changes on a staging site before using them in a live WooCommerce store.

How to customize WooCommerce PDF coupons with a custom font

Adding a font to a WooCommerce PDF coupon template involves two related steps. First, the font must appear in the drag-and-drop editor. Second, its local font files must be registered for PDF generation. Completing only the first step may make the typeface visible in the editor without ensuring that it is used correctly in the downloaded document.

1. Add a custom font to the PDF coupon editor

The following example adds Chango to the font list in the editor:

add_filter( 'fcpdf/core/editor/fonts', function( $fonts ) {
    $fonts['chango'] = [
        'name' => 'Chango',
        'url'  => 'https://fonts.googleapis.com/css2?family=Chango&display=swap',
    ];

    return $fonts;
} );

The array key identifies the font, the name value controls its label in the editor, and the url value loads the corresponding stylesheet. You can adapt the example for another Google Font, including the fonts selected for this project, by using the appropriate font name and verified stylesheet URL.

2. Register the custom font directory for PDF generation

The PDF engine needs access to local font files. In this example, the files are stored in the fonts directory inside WordPress uploads:

add_filter( 'fcpdf/core/fonts/dir', function( $dirs ) {
    $upload_dir = wp_upload_dir();
    $font_dir   = trailingslashit( $upload_dir['basedir'] ) . 'fonts';

    $dirs[] = $font_dir;

    return $dirs;
} );

Create the directory and upload the required .ttf files to:

wp-content/uploads/fonts/

Use font files that you are licensed to install and distribute in generated documents. File names and capitalization must match the values used in the font configuration.

3. Map the TTF files to the font styles

The next filter tells the PDF generator which files should be used for regular, italic, bold, and bold italic text:

add_filter( 'fcpdf/core/fonts/data', function( $fonts ) {
    $fonts['chango'] = [
        'R'  => 'Chango-Regular.ttf',
        'I'  => 'Chango-Regular.ttf',
        'B'  => 'Chango-Regular.ttf',
        'BI' => 'Chango-Regular.ttf',
    ];

    return $fonts;
} );

In this example, the same font file is assigned to every style because only one variant is available. If a font family includes separate bold or italic files, each variant should be mapped to the correct file instead.

The identifier used in the editor filter and the PDF font data must be consistent. In the example, both configurations use chango. The TTF file also needs to exist in the registered directory under exactly the same file name specified in the snippet.

The screenshot below shows the filters used to extend the available PDF coupon fonts:

PHP filters for adding custom fonts to WooCommerce PDF coupons

For further configuration guidance, visit the Flexible Coupons documentation.

How to verify the custom font in a WooCommerce PDF coupon

After adding the snippets and uploading the font files, check both the editor and the generated document. A practical test should include the following steps:

  1. Open the relevant coupon template in the drag-and-drop editor.
  2. Confirm that the new font appears in the available font list.
  3. Apply it to a text element and save the template.
  4. Generate a test coupon through the normal WooCommerce workflow.
  5. Download the PDF and verify its typography, spacing, special characters, and line breaks.
  6. Repeat the test for every font weight or style used in the design.

You can also explore the template-building workflow in the WooCommerce PDF Coupon Editor demo.

Case study result: branded WooCommerce PDF coupons

Once the font configuration was complete, the client received a coupon template that aligned more closely with the rest of the brand materials. The implementation delivered three practical results:

  • The custom font became available in the coupon template editor.
  • The PDF generator could use the corresponding local TTF file.
  • The finished coupon followed the client’s typography guidelines more consistently.

The requested font-size increase could not be implemented in the same way because the PDF library used in this setup limited the font size to 72 px. Rather than bypassing that constraint without a verified solution, the layout was adjusted within the supported range.

Common custom font problems in PDF coupons

If the editor shows the font but the generated PDF does not, review the following points:

  • Incorrect directory: confirm that the TTF file is stored in wp-content/uploads/fonts/.
  • File-name mismatch: check spelling, capitalization, and the .ttf extension.
  • Different font identifiers: use the same array key in the editor and PDF configuration.
  • Missing font variants: map bold and italic styles to their corresponding files when those variants are used.
  • Unsupported characters: ensure that the selected font contains the glyphs required for your customers’ names and messages.
  • Caching: clear relevant WordPress, browser, or server caches before testing the updated template again.

If you need assistance with the plugin configuration, you can contact Flexible Coupons support.

Why customize WooCommerce PDF coupons?

Typography is only one part of a useful coupon design, but it can have a significant effect on consistency and readability. A branded PDF can help customers immediately recognize who issued a gift card, service voucher, or event ticket.

Flexible PDF Coupons PRO supports practical template customization through features such as:

  • A drag-and-drop editor for building PDF layouts.
  • Customizable text, colors, images, and design elements.
  • PDF coupons connected with WooCommerce products and orders.
  • Personalized voucher information and recipient-facing content.
  • PHP filters for advanced development requirements, including custom font registration.

This flexibility is relevant to retail stores, salons, spas, gyms, event organizers, venues, and other businesses selling products, services, or experiences as printable documents.

Key takeaways for custom WooCommerce coupon fonts

  • A custom font must be configured for both the visual editor and the PDF generator.
  • The PDF engine requires a local, correctly named font file.
  • Matching identifiers connect the editor font with its PDF configuration.
  • Separate font weights should use their appropriate TTF files when available.
  • Font licensing and character support should be checked before launch.
  • A generated PDF should always be tested instead of relying only on the editor preview.
  • Some layout limits, including the 72 px font-size limit in this case, may still apply.

Summary

This case study shows how custom fonts in WooCommerce PDF coupons can be implemented with Flexible PDF Coupons PRO and its PHP filters. Registering the font in the editor, providing local TTF files, and mapping those files for PDF generation creates a consistent workflow from template design to the finished document.

For stores that need branded gift cards, printable vouchers, service credits, or PDF event tickets, this customization provides greater control over typography without replacing the existing WooCommerce coupon workflow.

Flexible PDF Coupons PRO for WooCommerce

Design branded PDF coupons and sell them as gift cards, service vouchers, or event tickets. Customize layouts in the editor and extend selected workflows with relevant add-ons when needed.

Add to cart
or
View details

WP Desk

About Krzysztof Skorupa

Technical Support Specialist at WP Desk, expert in WooCommerce and WordPress plugins. He documents features, supports users, and collaborates on plugin improvements.

  • Terms & Conditions
  • Privacy Policy
  • Support Policy
  • Refund Policy

© 2026 WP Desk WP Desk & Flexible Coupons

Manage Consent

We use necessary cookies to make our site work. We'd also like to set additional cookies to understand site usage, enhance your browsing experience, and serve personalized ads or content. By clicking ‘Accept All,’ you consent to our use of additional cookies.

Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}