• Hello, we use pdf packing slips plugin and pull through custom text onto the invoices. On version 2 we used to check what options were used with :

    $option_meta = $item->get_meta(‘Option’);

    then we would check

    if (str_contains($option_meta, ‘Gift Card’) || str_contains($option_meta, ‘Gift Wrap & Card’)):

    Then we get the actual data with

    $item_data = $item->get_meta(‘_ywapo_meta_data’);

    foreach ($item_data[1] as $message): echo $message; endforeach

    But now option_meta always returns null – please could you advise what we should be checking against instead now?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Alessio Torrisi

    (@alessio91)

    Hi there,

    thank you for contacting us.

    Please use following code and let me know if it’s helpful in your case.

    $meta_data     = wc_get_order_item_meta( $item_id, '_ywapo_meta_data', true );
    Thread Starter user9876789

    (@user9876789)

    Using $meta_data = wc_get_order_item_meta( $item_id, ‘_ywapo_meta_data’, true ); worked for getting a text message field

    I also have a select dropdown with the name ‘Select an occasion (if applicable)’ which lists various events which someone selects. I call that onto the PDF packing slip with:

    <?php $occasion = $item->get_meta('Select an occasion (if applicable)'); ?>
    
    <td>Occasion: <?php if ($occasion != null && $occasion != ''): echo $occasion; else: echo 'N/A'; endif; ?></td>

    Since version 4.6.0 this has stopped working. I’ve tested 4.6.0 and 4.7.1 and it doesn’t work on those either. 4.5.0 is the last one it works on. Could you advise if something has changed and how I can call that data now?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get meta data’ is closed to new replies.