• Resolved jackofallspades

    (@jackofallspades)


    Hi there,

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

    This is what I have:
    <tbody>
    <tr><th>Subtotal</th><td>[wcj_cart_subtotal]</td></tr>
    <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>Taxes</th><td>[wcj_order_total_tax]</td></tr>
    <tr><th>Order Total</th><td>[wcj_order_total]</td></tr>

    </tbody>

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

Viewing 15 replies - 1 through 15 (of 17 total)
  • Hi,

    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?

    Thread Starter jackofallspades

    (@jackofallspades)

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

    Thread Starter jackofallspades

    (@jackofallspades)

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

    Hi,

    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.

    Thread Starter jackofallspades

    (@jackofallspades)

    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?

    Hi,

    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 (https://booster.io/shortcodes/wcj_order_meta/) 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.

    Thread Starter jackofallspades

    (@jackofallspades)

    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.

    Hi,

    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 (https://booster.io/shortcodes/wcj_order_meta/).

    Thread Starter jackofallspades

    (@jackofallspades)

    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?

    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.

    Thread Starter jackofallspades

    (@jackofallspades)

    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:
    https://snag.gy/qQfpDy.jpg

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

    In their invoice, it shows them this:
    https://snag.gy/QjapCf.jpg

    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?

    I see.

    You should replace subtotal shortcode with [wcj_order_subtotal] (https://booster.io/shortcodes/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.

    Thread Starter jackofallspades

    (@jackofallspades)

    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:

    -$20.40

    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:

    20.4

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

    Hi,

    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.

    Thread Starter jackofallspades

    (@jackofallspades)

    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,
    Carrie

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Coupons not showing on pdf invoice’ is closed to new replies.