[wcj_order_items_table]

Display order items table

Description

[wcj_order_items_table] shortcode displays WooCommerce order items table. Shortcode is the main part of invoice template in PDF Invoices module.

Args

columns
(required) List of predefined table columns you need to display. Columns identifiers must be separated by vertical bar ( | ). Possible column identifiers are:

  • item_number
  • item_name
  • item_short_description
  • item_variation
  • item_thumbnail
  • item_sku
  • item_quantity
  • item_total_tax_excl
  • item_total_tax_incl
  • item_subtotal_tax_excl
  • item_subtotal_tax_incl
  • item_tax
  • item_weight
  • item_product_input_fields
  • item_key
  • line_total_tax_excl
  • line_total_tax_incl
  • line_subtotal_tax_excl
  • line_subtotal_tax_incl
  • line_tax
  • line_subtax
  • line_tax_percent
  • debug
Default: None
columns_titles
(optional) List of vertical bar ( | ) separated column titles.

Default: None
columns_styles
(optional) List of vertical bar ( | ) separated column styles.

Default: None
hide_currency
(optional) If set to yes will hide currency symbol from result.

Default: no
table_class
(optional) HTML class for the resulting table.

Default: None
shipping_as_item
(optional) If not empty, shipping will be added to order items list as line item. It is possible to add shipping method name to the item’s name, by adding %shipping_method_name% to the attribute value.

Default: None
discount_as_item
(optional) If not empty, discount will be added to order items list as line item.

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

Default: The current order ID, if exists
tax_percent_format
(optional) Format for outputting percent data in table.

Default: %.2f %%
item_image_width
(optional) Attribute used only if item_thumbnail column is enabled.

Default: None
item_image_height
(optional) Attribute used only if item_thumbnail column is enabled.

Default: None
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
visibility
(optional) Make shortcode results visible to everyone (all), or to admin only (admin).

Default: all

Usage Example

This will create invoice with 3 columns: item counter, item name and price, setting column titles and styles accordingly:

[wcj_order_items_table table_class="pdf_invoice_items_table"
columns="item_number|item_name|line_total_tax_incl"
columns_titles="|Product|Total"
columns_styles="width:5%;|width:65%;|width:30%;text-align:right;"]
Recommended for PDF Invoicing and Packing Slips module
Accessible through:
  • [wcj_order_items_table]
Tested on WooCommerce 3.1.1 and WordPress 4.8
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

35 Comments

  1. Rune February 18, 2015 at 10:10 pm #

    Hello,

    I posted an support ticket a few days ago but i think it has dissapeared. I can not get this shortcode to work for V2 invoice.
    I have it set like this: columns=”item_number|item_name|item_quantity|wcj_product_price|line_total_tax_excl”

    Also i was asking for a line total shortcode incl. tax. I have to use V2 invoice where i have different number for order, invoice and packinglist.
    In V1 the invoice number is the same as the order number, and the subtotal is only excl. tax.

    I need each product line to include name, quantity, price(incl. tax), line_total(incl.tax)
    Then the sum fields like this:
    Subtotal: same as line_total(incl.tax)
    Discount: (incl. tax)
    Shipping: (incl.tax)
    Wherof 25%tax: The tax amount
    Sumtotal: total sum incl. tax

    But i can not figure out how to setup this using V2 invoice.

    Brgds
    Rune

    Reply

    • WooJetpack Support Team February 19, 2015 at 2:54 pm #

      Hi Rune,

      Sorry for the delayed reply.

      Regarding [wcj_order_items_table] shortcode columns – I’ve started documentation page – http://booster.io/shortcodes/wcj_order_items_table/ – please check it.
      Regarding numbering in PDF Invoice V2 – you can set invoice numbers same as order id – uncheck sequential numbering and use Renumerate Invoices tool.
      I’m going to add documentation for PDF Invoices V2 in an couple of days, hope it will be more clear.

      Best regards,
      Tom

    • Rune February 19, 2015 at 4:03 pm #

      Thank you Tom, that made things more clear.

      Yes i will use V2 because it has separate numbering for invoice, order and packlist, so this is great.

      My main problem is that in Norway if a new company is still not registered with the tax system they are not allowed to specify tax in the invoice, this means that all prices needs to be included tax. I can not find shortcode for the subtotal in pdf_invoice_totals_table which inclue tax.

      Thanks again.

      Brgds
      Rune

  2. Rune February 20, 2015 at 10:39 am #

    Back again with an image of what i am trying to setup. Checked your shortcode files and did some tests and actually easy to make this work. I can buil a custom function to handle this for my own use but i really think many should be interested to have it build into plugin.

    http://www.arctic-fritid.no/wp-content/uploads/2015/02/invoice.pdf

    The product line with product price BEFORE discount, then the given discount and then linetotal after discount (all incl. tax). Separate fields which displays tax.

    Then in the total table we need subtotal incl tax, shipping incl. tax and sum total incl. tax.

    I hope this explains my needs and that it is in your interest to add to code.

    Brgds
    Rune

    Reply

    • Rune February 20, 2015 at 10:29 pm #

      Ok, i have solved most of my problems by using the “discount_as_item=”Discount”

      Then i have the product line with all amounts including TAX
      And the discount line looks ok.

      2 problems still and that is the Subtotal does not summer all product lines, the discount line/amount is not included so when i add a Discount -$100 in table total it all looks wrong. And Shipping price is only available excl. TAX (should also be incl. tax)

      With these 2 in place i can use a bottomline like “Whereof 25% tax: $111.00”

      By now i have made 2 new shortcodes in class-wcj-orders-shortcodes.php so it works for me until next update 😉
      So I hope these 2 (or similar) shortcodes can be implemented,

      wcj_order_subtotal_incl_discount and wcj_order_shipping_price_incl_tax

      Brgds
      Rune

    • WooJetpack Support Team February 25, 2015 at 10:09 am #

      Hi Rune,

      Sorry for the delayed reply.
      1. [wcj_order_subtotal_after_discount] added.
      2. Regarding your second request about wcj_order_shipping_price_incl_tax – the [wcj_order_shipping_price] shortcode should return shipping incl. TAX, while [wcj_order_shipping_price excl_tax="yes"] will display the shipping excluding the TAX. I’ve tested on our test server – it seems to work as expected. Please let me know if I missed something.

      Best regards,
      Tom

  3. vieradel September 14, 2015 at 1:34 pm #

    Hello, I have found the following. Is there any solution?
    http://prntscr.com/8g7v2q

    “Extra WooCommerce Product Options” Fields

    Thanks!

    Reply

    • Valentin Solovjov September 14, 2015 at 4:51 pm #

      Dear Vieradel,

      what “Extra WooCommerce Product Options” Fields do you need?

      BR,
      Val

  4. Moritz Walter March 11, 2016 at 1:27 pm #

    Hi! Just processed a partial refund, is there a way to display the refunded amount as a position in this table somehow? All the best, Moritz

    Reply

  5. Daniele April 13, 2016 at 9:51 am #

    How can I print unit price (with or without tax) in wcj_order_items_table?

    Reply

    • Valentin Solovjov April 20, 2016 at 8:37 pm #

      HI,

      try these attributes for shortcode [wcj_order_items_table]

      item_total_tax_excl
      item_total_tax_incl

      BR,
      Val

  6. Tim May 24, 2016 at 4:41 am #

    Is there a way to display the weight of each item such as “item_weight”?

    Reply

    • Booster Support Team May 24, 2016 at 9:28 am #

      Hi Tim,

      Wasn’t possible, but I’ve just added it to the plugin. Please download the development version here – http://booster.io/dev/. You will need to uninstall the old version first (don’t worry your saved settings won’t disappear). As you suggested, new column is named item_weight. Please let me know if it works as expected.

      Best regards,
      Tom

      Booster Support Team
    • Tim May 24, 2016 at 9:39 am #

      Awesome. Thanks guys!

    • Booster Support Team May 24, 2016 at 10:19 am #

      No problem 🙂
      Please let me know if you need anything else added.

      Best regards,
      Tom

      Booster Support Team
  7. Marcel November 6, 2016 at 10:58 am #

    How can I include just the item name in a template, without the table structure?

    Reply

    • Booster Support Team November 6, 2016 at 10:59 pm #

      Hi Marcel,

      Don’t think it’s possible at the moment, but I could add it to the plugin. However I would need more details – do you want to list all order items as some list (e.g. each item name on separate line), is that correct?

      Best regards,
      Tom

      Booster Support Team
  8. franck November 25, 2016 at 10:58 pm #

    Hello,
    I use the “item_product_input_fields” in my billing template inside the shortcode “[wcj_order_items_table].
    The table is ok and all the columns i need are in place. But the areas for “item_product_input_fields” are empty.
    What do i do wrong ?
    Best regards.

    Reply

    • franck November 25, 2016 at 11:44 pm #

      Sorry everything works well.
      I just had to upgrade booster to 2.5.6 and that’s it !!
      Very great plug-in.
      Thanks.

    • Booster Support Team November 26, 2016 at 5:58 pm #

      Hi Franck,

      Thank you 🙂

      Best regards,
      Tom

      Booster Support Team
  9. maryann December 17, 2016 at 5:26 am #

    Hello,

    I cant seem to get discount per product in PDF invoice.
    This is what I’ve done –
    columns=”item_number|item_name|item_quantity|line_total_tax_excl|discount_as_item”
    columns_titles=”|Product|Qty|Total|Coupon Discount”
    What am i doing wrong?
    Thanks

    Reply

    • Booster Support Team December 19, 2016 at 8:27 pm #

      Hi Maryann,

      Sorry for a delay. discount_as_item attribute should be used like that:

      It will display order discount as line in order items table.

      Please let me know if you have any questions.

      Best regards,
      Tom

      Booster Support Team
    • maryann December 28, 2016 at 8:47 am #

      Hello,

      Is there any way i can show discount per product in PDF invoice?

      Thanks

  10. Ugenijus February 15, 2017 at 8:41 am #

    Hello,

    This code worked for a long time, but now stops, because of item_thumbnail. If i remove this from code, everything is ok.

    [wcj_order_items_table table_class=”pdf_invoice_items_table”
    columns=”item_sku|item_name|item_thumbnail|item_quantity|line_total_tax_incl”
    columns_titles=”SKU|Product|Image|Qty|Suma”
    columns_styles=”width:10%;|width:40%;|width:30%;|width:10%;|width:10%;text-align:left;”
    item_image_width=”120px”
    item_image_height=”120px”]

    Whats wrong, please?

    I use Booster Plus.

    Thank You

    Reply

    • Ugenijus February 21, 2017 at 11:01 am #

      WordPress 4.7.2.
      Woocommerce 2.6.14
      Booster for WooCommerce 2.5.9
      Booster Plus for WooCommerce 1.1.0

      When I use this code on PACKING SLIPS HTML Template, PDF file can’t be downloaded or previewed.
      [wcj_order_items_table table_class="pdf_invoice_items_table"
      columns="item_sku|item_name|item_thumbnail|item_quantity|line_total_tax_incl"
      columns_titles="SKU|Prekė|Foto|Kiekis|Suma"
      columns_styles="width:10%;|width:40%;|width:30%;|width:10%;|width:10%;text-align:left;"
      item_image_width="120px;"
      item_image_height="120px;"]

      If I remove – item_thumbnail – everything works ok, PDF file is downloadable. This code works ok:
      [wcj_order_items_table table_class="pdf_invoice_items_table"
      columns="item_sku|item_name|item_quantity|line_total_tax_incl"
      columns_titles="SKU|Prekė|Kiekis|Suma"
      columns_styles="width:10%;|width:70%;|width:10%;|width:10%;text-align:left;"]

  11. Rory Restani March 23, 2017 at 5:55 pm #

    how do I hide products from the pdf invoice?

    I have several woo commerce items which are hidden from the store and bundled together as a kit. On my checkout and new order emails from woo commerce the items stay hidden but they appear as a long list on the pdf.

    I want hidden products to stay hidden on the pdf invoice.

    Reply

  12. Stevan Wilts May 2, 2017 at 9:36 am #

    Hello, I have a problem that occured since the last update. The item_variation now displays is_custom behind every variation. I have no idea how to get rid of this. Can you help me with this? Thanks in advance!

    Greetings,

    Stevan

    Reply

    • Booster Support Team May 2, 2017 at 12:20 pm #

      Hi Stevan,

      Thanks for pointing that out. I’ve just made some changes to the plugin. Please download the development version here – https://booster.io/dev/. You will need to uninstall the old plugin version first (don’t worry your saved settings won’t disappear). Please let me know if it’s fixed now.

      Best regards,
      Tom

      Booster Support Team
    • Stevan Wilts May 2, 2017 at 12:48 pm #

      Yes, thank you! That fixed it.

    • Booster Support Team May 2, 2017 at 12:52 pm #

      Happy to hear it’s fixed. Please let me know if you notice any more bugs.

      Best regards,
      Tom

      If you like Booster, please leave us a rating.

      Booster Support Team
  13. Dan May 2, 2017 at 8:24 pm #

    Hi,

    i am generating an email using the shortcode [wcj_order_items_table] and in sent email i see “is_custom:” next to the product variants. What is it and how do I delete it?

    Thank you!

    Reply

  14. robinson rajan May 31, 2017 at 2:53 pm #

    item sale price Args not in the list of shortcode wcj_order_items_table

    how do i show the individual item sale price

    Reply

  15. Gregor June 6, 2017 at 1:29 pm #

    Hello,

    I have noticed that the field item_name doesn’t display the variation any more. It has in the past.
    I have also tried item_variation and item_sku, but that fields were always empty.

    Found your plugin really helpful.

    Reply

    • Booster Support Team June 6, 2017 at 6:53 pm #

      Hi Gregor,

      Thanks.

      Please try adding add_variation_info_to_item_name="yes" attribute to the [wcj_order_items_table] shortcode, something like this:

      Please let me know if that helped, or if you have any questions or need any help.

      Best regards,
      Tom

      Booster Support Team
  16. Ivan July 14, 2017 at 10:40 pm #

    How can I also display fee items as entries in this table? Similar to how the shipping can be displayed. Thanks for your help!

    Reply