Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Display used coupons in custom template

  • Resolved btetrault

    (@btetrault)


    Looking to display the used coupons for an order on an invoice.

    I’m using a custom template in my child theme. Is there a snippet to use similar to what’s already there? E.g. <?php $this->order_date(); ?> ?

    If not, any tips on adding such a function? I’ve already customized the template a ton, so would prefer to not have to rebuild the template using the premium templates plugin.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor kluver

    (@kluver)

    Hi @btetrault,

    You could add the following code snippet to your custom template:

    <?php $this->custom_field('used_coupons', 'Used coupons:'); ?>

    With kind regards,

    Michael

    Thread Starter btetrault

    (@btetrault)

    Thanks Michael,

    When I use this bit of code, it only displays the words ‘Used coupons:’ but not the actual coupons used in that order.

    Are coupons considered a custom field? Could that be the problem? I should also mention, I’m using WooCommerce Smart Coupons extension–not sure if that changes anything?

    Plugin Author Ewout

    (@pomegranate)

    Hi! ‘used_coupons’ is not a custom field, so indeed that snippet won’t work.

    With the Premium templates extension you can show the coupons used by writing ‘{{used_coupons}}’ in a custom block of type ‘text’. (more information about this: using custom blocks)

    For a solution for the free version, take a look at the post here:
    How can I show the coupon code on my invoices

    Hope you find it helpful!

    Ewout

    Thread Starter btetrault

    (@btetrault)

    That did the trick, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display used coupons in custom template’ is closed to new replies.