Viewing 1 replies (of 1 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @easywebsitesltd,

    The easiest way is with our Premium Templates extension. With it you can create a custom block in the customizer. Using the {{used_coupons}} placeholder will show the coupon codes on your document.

    In the free version you can achieve the same result with a small code snippet:

    //Add used coupons to invoice
    add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_coupons_used_invoice', 10, 2 );
    function wpo_wcpdf_coupons_used_invoice ($template_type, $order) {
        if( ( $used_coupons = $order->get_used_coupons() ) && $template_type == 'invoice' ) {
            $coupons_list = implode(', ', $used_coupons);
            echo '<h4>' . __('Coupons used') . '</h4>';
            echo '<p>' . $coupons_list . '</p>';
        }
    }

    This code snippet should be placed in the functions.php of your child theme. If you haven’t worked with code snippets or functions.php before please read this guide: How to use filters

Viewing 1 replies (of 1 total)
  • The topic ‘Display coupon code on invoice’ is closed to new replies.