[wcj_order_custom_field]

Display WooCommerce order custom field

Description

[wcj_order_custom_field] shortcode displays WooCommerce order custom field.

Args

name
(required) Custom field name.

Default: None
key
(optional) If field value is an array, you can additionally set array key to retrieve.

Default: None

Examples

[wcj_order_custom_field name="my_custom_field"]
[wcj_order_custom_field name="_adq_wpcf7" key="text-77" before="Field value: "]
Accessible through:
  • [wcj_order_custom_field]
Tested on WooCommerce 4.1.1 and WordPress 5.4.1
Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.

Leave a Reply

Comments

6 Comments

  1. Matt June 5, 2020 at 11:51 pm #

    Will this work for arrays within arrays?

    Here is an example of a custom field from within one of my orders:

    “shipping_lines”:[{“id”:64,”method_title”:”On-Farm Pickup”,”method_id”:”local_pickup_plus”,”instance_id”:”0″,”total”:”0.00″,”total_tax”:”0.00″,”taxes”:[],”meta_data”:[{“id”:677,”key”:”_pickup_appointment_start”,”value”:”1591279200″},{“id”:678,”key”:”_pickup_appointment_end”,”value”:”1591280100″},{“id”:679,”key”:”_pickup_location_id”,”value”:”783″},{“id”:680,”key”:”_pickup_location_address”,”value”:{“country”:”CA”,”state”:”ON”,”postcode”:”O0O0O0″,”city”:”London”,”address_1″:”7375 Example Road”,”address_2″:””}},{“id”:681,”key”:”_pickup_location_name”,”value”:”Millar Berry Farms”},{“id”:682,”key”:”_pickup_location_phone”,”value”:”1234567890″},{“id”:707,”key”:”_pickup_items”,”value”:[59,63]}]},{“id”:65,”method_title”:”On-Farm Pickup”,”method_id”:”local_pickup_plus”,”instance_id”:”0″,”total”:”0.00″,”total_tax”:”0.00″,”taxes”:[],”meta_data”:[{“id”:689,”key”:”_pickup_appointment_start”,”value”:”1591452000″},{“id”:690,”key”:”_pickup_appointment_end”,”value”:”1591452900″},{“id”:691,”key”:”_pickup_location_id”,”value”:”785″},{“id”:692,”key”:”_pickup_location_address”,”value”:{“country”:”CA”,”state”:”ON”,”postcode”:”O0O0O0″,”city”:”London”,”address_1″:”7375 Example Road”,”address_2″:””}},{“id”:693,”key”:”_pickup_location_name”,”value”:”Location – Greens Pickup”},{“id”:694,”key”:”_pickup_location_phone”,”value”:”1234567890″},{“id”:708,”key”:”_pickup_items”,”value”:[60,62]}]},{“id”:66,”method_title”:”On-Farm Pickup”,”method_id”:”local_pickup_plus”,”instance_id”:”0″,”total”:”0.00″,”total_tax”:”0.00″,”taxes”:[],”meta_data”:[{“id”:701,”key”:”_pickup_appointment_start”,”value”:”1591365600″},{“id”:702,”key”:”_pickup_appointment_end”,”value”:”1591366500″},{“id”:703,”key”:”_pickup_location_id”,”value”:”786″},{“id”:704,”key”:”_pickup_location_address”,”value”:{“country”:”CA”,”state”:”ON”,”postcode”:”O0O0O0″,”city”:”London”,”address_1″:”7375 Example Road”,”address_2″:””}},{“id”:705,”key”:”_pickup_location_name”,”value”:”Location – Baked Goods Pickup”},{“id”:706,”key”:”_pickup_location_phone”,”value”:”1234567890″},{“id”:709,”key”:”_pickup_items”,”value”:[61]}]}]

    I would like to display _pickup_appointment_start value as a Date and Time. Is this possible?

    Reply to thread

    Avatar
  2. Jeova June 5, 2020 at 3:17 am #

    Hi

    I’m using this shorcode to display a custom field, but the field is a date, so I wish I could use the date_format arg, like other specific data shorcode.
    Is there any way I can accomplish this result with custom field?

    Thanks.

    Reply to thread

    Avatar
    • RokasJ June 6, 2020 at 7:59 am #

      Hi,

      Unfortunately it’s currently not possible to do that yet.

      Best regards,
      Rokas – Support team

      Avatar
  3. albertm December 4, 2019 at 10:35 am #

    HI, I activated the “cost of good” module and now I need to recall that field (cost and expeditions) in the order summary.
    I use [wcj_order_custom_field] in the email custom, but I don’t understand what to insert as the name of the field to be called.
    tips?

    Reply to thread

    Avatar
  4. Ibrahim Jaber May 16, 2018 at 4:07 am #

    Does this fields use the meta keys? or is it something else

    Reply to thread

    Avatar