Viewing 1 replies (of 1 total)
  • Plugin Author ulihake

    (@ulih)

    Hello Lenykeksik.

    Thanks for your feedback.

    All data is stored in the database of your WordPress instance as a meta value associated with the post of type shop_order.

    This means you can use the wordpress function get_post_meta to retrieve the data of all fields configured for your checkout forms, internal and custom fields if you don’t have a valid WC_ORDER object available. In this case you will need the Order ID and you could retrieve the values stored with

    $email = get_post_meta([order_id], '_billing_email', true);

    If you have access to a valid Order object constructed by the class WC_ORDER you can use the field name of a default WooCommerce field like _billing_email to retrieve the value.

    $value = $order->billing_email;

    For custom fields you can use the field name as indicated in the settings of WooCommerce Poor Guys Swiss Knife in the Billing or Shipping Section

    $value = $order->billing_your_sanitized_custom_field_name;

    or

    $value = $order->shipping_your_sanitized_custom_field_name;

    Don’t forget to assure yourself that you have constructed the $order object with an order id otherwise you have to assure to load a valid order first.

    Hope this answer helps you with your code.

    Regards.
    uh

Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible use function get?’ is closed to new replies.