• Resolved Abner

    (@abnersamwebdev)


    Hello, I want to get a value for a specific product field, can someone help me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    The fields created using our plugin are saved using the function wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) .

    You can retrieve the value of the fields from the database by using the below function.

    wc_get_order_item_meta( $item_id, $key, $single = true )

    We hope this will help.

    Thank you!

    Hi, I saw that answer. However, I still don’t understand, could you help me a little?

    <span><strong><?php echo $product->get_name() . ' To: ' . wc_get_order_item_meta( $item_id, $key, $single = true ); ?></strong></span>

    The name of the field that I want to get the stored value for display is:
    recipients_name

    Plugin Author ThemeHigh

    (@themehigh)

    You can retrieve the value of the fields from the database by using the below function.

    wc_get_order_item_meta( $item_id, 'recipients_name', true );

    You can get the $item_id from the order details.

    Further, you can refer to the below link to get the item_id.

    https://wordpress.stackexchange.com/questions/97176/get-product-id-from-order-id-in-woocommerce

    We hope this will help.

    Thank you!

    Thread Starter Abner

    (@abnersamwebdev)

    Okay, thank you very much for your help. I don’t know what the guy’s solved, but my problem was solved.

    Plugin Author ThemeHigh

    (@themehigh)

    Great!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I get some field value?’ is closed to new replies.