• Resolved cmontcour

    (@cmontcour)


    Hi,

    I’m using the plugin “Woo Discount Rules” to set up my product discounts (Wholesale + User based). The discount is applied correctly and shows up on the cart, checkout, and the email confirmation, but I can’t get it to appear on the pdf invoice using the Booster Module “PDF Invoicing”.

    I have been using this shortcode https://booster.io/shortcodes/wcj_order_total_discount/.

    Here is the relevant part of my template:

    
    <p>
    [wcj_order_items_table table_class="pdf_invoice_items_table"
            discount_as_item="Discount"
        columns="item_number|item_name|item_product_input_fields_with_titles|item_total_tax_excl|item_quantity||line_total_tax_excl"
        columns_titles="|Produit|Précisions|Prix unitaire HT|Quantité||Total"
        columns_styles="width:5%;|width:35%;|width:15%|width:10%|width:12%;|width:8%;|width:15%;text-align:right;"]
    <table class="pdf_invoice_totals_table">
    <tbody>
        <tr><th>Port HT</th><td>[wcj_order_shipping_price excl_tax="yes"]</td></tr>
    <tr><th>Remise totale</th><td>[wcj_order_total_discount excl_tax="yes" hide_if_zero="no"]</td></tr>
         <tr><th>Total HT</th><td>[wcj_order_total_excl_tax]</td></tr>
        <tr><th>Total TVA</th><td>[wcj_order_total_tax hide_if_zero="no"]</td></tr>
         <tr><th>Total TTC</th><td>[wcj_order_total]</td></tr>
    </tbody>
    </table>
    </p>
    

    The discount is calculated correctly on the individual price in the pdf invoice, but the Discount text (eg. “Total discount: 15€” won’t show up)

    I’ve also tried using the Booster module “Wholesale price” instead of a 3rd party plugin, but the results are the same.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • llamy

    (@llamy)

    Hi,

    I’m facing exactly the same problem!
    Impossible to display the amount of the discount for each product on my pdf files.
    I use the Woo Discount Rules plugin to apply discount rules.
    Any idea of the shortcode to use in order to display the discount amount?

    I’ve tried things as [wcj_order_items_meta] or [wcj_product_meta] but it doesn’t work…

    Thanks!

    Thread Starter cmontcour

    (@cmontcour)

    Hi,

    I was able to achieve this using the code below (as an php snippet)

    `/*
    * alg_format_item_number_in_pdf_invoice.
    */
    function alg_format_item_number_in_pdf_invoice( $cell_data, $args ) {
    $item_total_tax_excl = $args[‘order’]->get_formatted_line_subtotal( $args[‘item’], false, true );
    if ( ‘line_total_tax_excl’ === $args[‘column’] ) {
    $cell_data = sprintf( $item_total_tax_excl);

    }
    return $cell_data;
    }
    add_filter( ‘wcj_pdf_invoicing_cell_data’, ‘alg_format_item_number_in_pdf_invoice’, PHP_INT_MAX, 2 );`

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pdf Invoice and Discounts’ is closed to new replies.