Support » Plugin: Booster for WooCommerce » Coupons not showing on pdf invoice

  • Resolved jackofallspades


    Hi there,

    The coupon deduction showing on the PDF invoice was working, and now it isn’t!

    This is what I have:
    <tr><th>Fuel Charge for Delivery</th><td>[wcj_order_shipping_price excl_tax]</td></tr>
    <tr><th>Coupon Code Discounts</th><td>[wcj_order_coupons]</td></tr>
    <tr><th>Order Total</th><td>[wcj_order_total]</td></tr>


    Now it is not returning the result there. Any idea what I have done?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Support RokasJ



    Could you go back to older orders that it worked before and see if they still have correct information? Also, what version of Booster are you using?



    Hi there, I have your most recent version, and now that I check it, yes in old invoices it is still showing.

    Hi there, still waiting to hear back on this. Thank you!

    Plugin Support RokasJ



    From what you’re describing it seems that your server no longer saves coupon data with correct meta keys as it used to before. I would recommend enabling “Show Order Meta” option in Booster’s “Admin Tools” module to see where this data is saved and then use [wcj_order_meta] shortcode to retrieve that data.

    I checked and that setting was already checked. I put in that shortcode in the invoice template but was not sure what I was supposed to look for? Could you clarify?

    Also, I noticed the NAME of the Coupon is now showing, but not the amount. What is the shortcode for the amount of the discount?

    Plugin Support RokasJ



    With show order meta option enabled you will be able to see all meta data that is saved. For example, _cart_discount key will hold coupon discount, _order_tax will be the tax. You could use [wcj_order_meta] shortcode ( to display this data instead of existing shortcodes, especially that it seems like the data is no longer saved in the correct meta keys as they used to before. It seems that your other issues you’ve recently reported on these forums are all very similar and may be signs of bigger underlying issue with data saving.

    Where do I put this shortcode [wcj_order_meta] ?

    I have put it randomly in my template but it does not show on the invoice.

    Plugin Support RokasJ



    Use it the way you would use other shortcodes. If you want to display coupon’s discount, then replace current shortcode with [wcj_order_meta] and appropriate key (

    I read the link that you supplied but I don’t follow. One of the examples in the documentation was this:

    [wcj_order_meta meta_key=”_your_key” before=”My key: “]

    So how would I enter this in my case for coupons? You make it seem like a simple fix, but I am not following any of your explanations. I don’t know what a key is. Could you “dumb down” your explanation for me?

    Plugin Support RokasJ


    Hi, sure.

    So essentially what most shortcodes do is they take information from products, orders or customers, which is in Woocommerce is saved as ‘meta’. Meta is additional information about the product/order/customer which is saved as a pair – a key and a value.

    One of the shortcodes you mentioned no longer works for you on new orders is [wcj_order_coupons], which basically takes information saved as ‘_cart_discount’ meta, although in more complex way. If this works for older orders and no longer works for new orders then this would mean that there might be an issue with Woocommerce on your server that makes it so that this data is no longer saved as meta with this key (for new orders) but rather something else, for some unknown reason.

    I proposed enabling “Show Order Meta” option in Booster’s “Admin Tools” module, which would allow you to see what exact information is saved. When you enable this option and go to any (new) order you will see at the bottom of the page all meta information that is saved – keys and values (in a table).

    Normally coupon data is saved with a ‘_cart_discount’ key, tax as ‘_order_tax’ key etc. You would see if this data is saved there or if it has some other meta key, therefore shortcodes cannot look it up. When you do this and find that it is saved as something else, you will be able to use [wcj_order_meta] shortcode.

    [wcj_order_meta] shortcode takes that data (you specify with meta_key argument which data) and then displays it. It’s an alternative to existing shortcodes and sometimes used in addition to existing shortcodes if one does not exist yet. With it you could display information that is missing for some reason for new orders with this shortcode instead.

    I hope this is more clear. If you want, you can enable the option I’ve mentioned and then take screenshots of some test order (make sure that no real private data is displayed) and share it here.

    Ah ha! Thank you so much for your detailed response! I know you said do a test order, but here I am not revealing any sensitive data.

    I see now for the most recent order this week where someone used a coupon code, the meta order shows this:

    _cart_discount 20.4
    _cart_discount_tax 2.65

    Here were the rest of the details:

    So this tells me that it is using the right order meta to get its coupon info.

    In their invoice, it shows them this:

    So both the subtotal is missing (this was another ticket I put in), and the coupon code amount is missing. Instead it just shows them the coupon name. I had wanted it to show the Stripe amount (also from another ticket) but was told that I couldn’t show that on the PDF invoice.

    So what would be the next steps then to get the coupon code amount to show, and the subtotal to show?

    Plugin Support RokasJ


    I see.

    You should replace subtotal shortcode with [wcj_order_subtotal] ( since this is already in the invoice and not in the cart (previous shortcode is meant to be used in cart).

    Unfortunately there isn’t a shortcode that would display both coupon names and their amounts, only names. This is the shortcode you are already using. You could add a new row however with [wcj_order_meta meta_key="_cart_discount"], this should display coupon discount (or I believe a sum of all coupons if multiple are allowed). If you are going to copy this shortcode, please delete quotation symbols and type them again because these forums replace them with a similar but not exactly the same symbol.

    Thank you! This solved my issue – I used the same logic to show the stripe fee, so that worked out too. My only other question, is this – is there a way to have it show like this:


    right now it shows the discount as a positive number, with no dollar sign, and only 1 decimal instead of 2.

    It looks like this:


    Let me know if there is a way to change that!

    Plugin Support RokasJ



    This data is saved as a positive number that’s why it’s displayed that way. But because coupons usually shouldn’t add a price, that is the discount should always be positive, you could add – manually before the shortcode or add before="-" argument. And if don’t have multiple currencies that could be used on checkout, you can also add a currency symbol this way.

    I tried adding that but I mustn’t be putting it in the right spot. I only have one currency btw.

    This is the way I tried it:
    <tr><th>Coupon Code</th><td>before=”-“[wcj_order_meta meta_key=”_cart_discount”]</td></tr>

    Obviously not right – can you show me how to do this line, with the minus sign – AND with the $ symbol?

    Thank you,

Viewing 15 replies - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.