Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi there,
    Thanks for contacting us!

    You tried the second code? Note that the first one has an error, so we sent another with the correction.

    This issue happens only in the complete order email?
    If you check the PDF, it has the code inside?

    Where did you placed the code?
    Please, let us know.

    Have a nice day!

    Thread Starter makemagik

    (@makemagik)

    Hi Hector, I used the second code indeed.

    This issue happens to the New order email. I haven’t checked the completed one, but it should show up in the New order email anyway.

    There’s no PDF attached to this email.

    The code was placed inside the functions.php.

    Hi there,

    The code is using a hook directly from WooCommerce, so for sure it should be changing anything.
    If it’s not outputting anything, it could be because the code is wrongly placed.

    Have you checked that the code is placed out of any other function and that it’s executing? Maybe you have any other code with the same hook:

    woocommerce_order_item_meta_start

    If so, could you try changing the priority of the function?

    If you do not know how to do it, please let us know and we would try to explain it in more detail

    Have a nice day!

    Thread Starter makemagik

    (@makemagik)

    The hook is working properly. I have added some custom content to the output and it does indeed output and shows in the email. I would definitely want to buy the premium version but I need to have this figured out.

    Also, keep in mind that I have made a blank setup with WordPress, WooCommerce and YITH Gift Card plugin using the Twenty Twenty-Three theme. Therefore, I’m pretty confident no other action is ran on that specific hook. All latest version also.

    • This reply was modified 1 year, 5 months ago by makemagik.

    Hello there!

    That’s really strange. If the code works if you have something custom on it, it means that the code of the gift card it’s empty, which should not be possible.

    Could you delete the “if” from the code, and check if that way it works?
    But it should not show nothing since the code could be empty.

    Please, let us know.

    Thread Starter makemagik

    (@makemagik)

    Hi there,

    It’s almost what I’ve done, see the code below. I used a else to check if the variable was empty and it is.

    function ski_show_gift_card_code_on_email( $order_item_id, $item, $order ) {
    
    $code = wc_get_order_item_meta( $order_item_id, '_ywgc_gift_card_code', true );
    
    if ( ! empty( $code ) ) {
    
    printf( '<br>' . __( 'Code de la carte cadeau: %s', 'yith-woocommerce-gift-cards' ), $code[0] );
    
    } else {
    
    printf('<br>Empty %s: ', $order_item_id);
    
    }
    
    }
    
    

    The Empty shows up in the email.

    Hello there,

    Then that means there’s no code to send. So, basically, the product is not a gift card.
    Could that be possible?

    Have you made any modifications to the plugin?

    What happens if you reinstall the plugin from scratch and delete your (possible) modifications inside your theme?

    Please, let us know.
    Have a nice day!

    Thread Starter makemagik

    (@makemagik)

    The product was indeed a gift card. I saw the code on the order page when it processed (see screenshot).

    No modification to the plugin was made. Only the code added to the theme file. As said, I am using an empty WordPress installation.

    I will remake a new setup and reinstall the plugin and do some test and get back to you.

    Hi there,

    Okay, perfect. Let us know.

    I tried it in my local environment and it works well, so I’m interested in knowing what could be the issue.

    Have a nice day!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Gift code not showing in admin email’ is closed to new replies.