[wcj_order_items_meta]

Display WooCommerce order items meta

Description

[wcj_order_items_meta] shortcode displays WooCommerce order items meta.

Args

meta_key
(required) Order items meta key name.

Default: None
order_id
(optional) The integer ID for an order.

Default: The current order ID, if exists
before
(optional) Text to place before the content. If content is empty this argument is ignored.

Default: None
after
(optional) Text to place after the content. If content is empty this argument is ignored.

Default: None
billing_country
(optional) Make shortcode results visible only in orders with specific billing country. Value is two letter country code. Can be comma separated list.

Default: None
not_billing_country
(optional) Make shortcode results visible only in orders excluding specific billing country. Value is two letter country code. Can be comma separated list.

Default: None

Examples

This will display global (i.e. all products) product input field nr. 1:

[wcj_order_items_meta meta_key="_wcj_product_input_fields_global_1"]

This will display local (i.e. per product) product input field nr. 1:

[wcj_order_items_meta meta_key="_wcj_product_input_fields_local_1"]
Accessible through:
  • [wcj_order_items_meta]
Tested on WooCommerce 3.5.2 and WordPress 5.0
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

3 Comments

  1. huangzec February 5, 2017 at 4:48 am #

    I need to format the order_items_meta value, for example: [wcj_order_items_meta meta_key="Extras"], how should i do?

    Reply to thread

  2. giuseppe martone December 4, 2018 at 9:21 am #

    Hello Staff
    We are testing this feature (plugin free version)
    We would like to print into Invoice some “wc-item-meta”.

    In our website, we inserted this snippet into child functions.php so we are able to show into back-office > manage single order >> manage single meta data.
    ——————————————————————————
    function add_order_item_meta($item_id, $values) {
    $key = ‘COLLI’; // Define your key here
    $key2 = ‘LOTTO’; // Define your key here
    $value = ‘value’; // Get your value here
    $value2 = ‘ value ‘; // Get your value here
    woocommerce_add_order_item_meta($item_id, $key, $value);
    woocommerce_add_order_item_meta($item_id, $key2, $value2);
    }
    add_action(‘woocommerce_add_order_item_meta’, ‘add_order_item_meta’, 10, 2);
    ——————————————————————————————
    Question:
    How to print those meta_key and relative meta_value into Invoice template? Is it possible?
    ———————————————
    columns=”item_sku|item_name|COLLI-Key|LOTTO-key|item_quantity|line_total_tax_excl”
    columns_titles=”Codice|Prodotto|COLLI_value|LOTTO_value|Qty|Totale”
    columns_styles=”width:15%;|width:52%;|width:6%;text-align:center;|width:6%;text-align:center;|width:6%;text-align:center;|width:10%;text-align:right;”]
    ———————————————–

    Someone can help me please?
    BR
    Giuseppe

    Reply to thread

    • RokasJ December 4, 2018 at 8:02 pm #

      Hi Giuseppe,

      You would need to add these columns to your [wcj_order_items_table]:
      item_meta=COLLI-Key
      item_meta=LOTTO-key
      where COLLI and LOTTO keys are actual meta keys.

      Best regards,
      Rokas – Support Team