[wcj_order_total_discount]

Display WooCommerce order total discount

Description

[wcj_order_total_discount] shortcode displays WooCommerce order total discount. Can be displayed with or without TAX.

Args

order_id
(optional) The integer ID for an order.

Default: The current order ID, if exists
excl_tax
(optional) Including (no) or excluding (yes) the taxes.

Default: no
hide_if_zero
(optional) If set to yes will return empty string instead of numeric zero “0”. Can be used in conjunction with before and after args, so in case the result is zero, the whole content will be hidden.

Default: no
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

Usage Example

Shortcode is intended (but not limited) to use with PDF Invoicing and Packing Slips module.

<table class="pdf_invoice_totals_table">
<tbody>
    <tr><th>Subtotal</th><td>[wcj_order_subtotal]</td></tr>
    [wcj_order_total_discount hide_if_zero="yes" before="<tr><th>Discount</th><td>" after="</td></tr>"]
    <tr><th>Taxes</th><td>[wcj_order_total_tax hide_if_zero="no"]</td></tr>
    <tr><th>Order Total</th><td>[wcj_order_total]</td></tr>
</tbody>
</table>
Recommended for PDF Invoicing and Packing Slips module
Accessible through:
  • [wcj_order_total_discount]
Tested on WooCommerce 3.6.4 and WordPress 5.2.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. inibg March 13, 2019 at 11:05 am #

    Can I show the discount as a percent?

    As example:
    Discount: 20%

    Reply to thread

    Avatar
    • RokasJ March 13, 2019 at 11:54 pm #

      Hi,

      Unfortunately not yet but we have added it to our todo list.

      Best regards,
      Rokas – Support Team

      Avatar
    • inibg March 15, 2019 at 11:50 pm #

      Hi Rokas,

      Thank you.

      Do you have any estimate about that feature?

      Avatar
    • RokasJ March 16, 2019 at 2:53 pm #

      Hi,

      Unfortunately not, all requests are handled by development team.

      Best regards,
      Rokas – Support Team

      Avatar
  2. Akval April 7, 2019 at 1:17 am #

    Hello! Can I exclude shipping cost from this? I am using coupons, for example 5% which is given from order total items value and shipping is not discounted. This shortcode uses the right percentage, but counts discount on shipping costs too. For example order total discount is 1,19, but this shortcode gives 1,40, which is because shipping costs.

    Reply to thread

    Avatar
    • RokasJ April 7, 2019 at 9:25 am #

      Hi,

      Unfortunately it’s not currently possible to exclude shipping however we have added it to our to-do list.

      Best regards,
      Rokas – Support Team

      Avatar