Support » Plugin: WooCommerce Print Invoice & Delivery Note » Discounted price for each line item

  • Resolved thisisbbc

    (@thisisbbc)


    Hello there,

    Is it possible to add a strikethrough original price with the discounted price (if available) for each line item?

    Our tests have been unsuccessful so far, would appreciate a hand!

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @thisisbbc,

    In order to achieve your requirement, you will need to customize the print-content.php template.

    Find the td element with class ‘product-item-price’ and add the following code inside the td element:

    <span style="text-decoration: line-through;"><?php echo wc_price( $product->get_price() ); ?></span><br>

    Once, the changes are done, you can copy and paste that modified template file in your active theme’s woocommerce folder. So that this modification will not get removed after every update of our plugin.
    Path: <Your active theme folder>/woocommerce/print-order/print-content.php

    Please let us know if you need any help or have any questions with it.

    Regards,
    Komal Maru

    Hi, I’m trying to achieve something similar, but instead I would like to show the discount amount per product line, just like it is shown when you are inside WooCommerce Orders and viewing a specific order.

    Example

    An also, I can not find the print-content.php inside my woocommerce-delivery-note folder so I can copy it to my active themes woocommerce folder.

    What have I missed?

    @komal-maru thank you very much for the snippet, worked like a charm! Just had the time to test it now.

    @antonioriveras this is exactly what this solution does. The file “print-content.php” is located in “/woocommerce-delivery-notes/templates/print-order/”. If you can’t find this file here you might want to re-download the plugin.

    @komal-maru @antonioriveras btw I added a condition to check if the price was actually different so that you don’t get the same price displayed twice.

    This ensure that a discount is available to display a strikethrough price:

    `<td class=”product-item-price”>
    <?php
    $pr_ori = wc_price( $product->get_price() );
    $pr_dis = wcdn_get_formatted_item_price( $order, $item );
    if($pr_ori != $pr_dis) : ?>
    <span style=”text-decoration: line-through;”><?php echo $pr_ori; ?></span><br>
    <?php endif; ?>
    <span><?php echo $pr_dis; ?></span>
    </td>`

    It’s not working for us because what we do is that we set a fixed bulk discount price with the plugin “WooCommerce Bulk Pricing”

    So we only want to show the discount amount just as in my example here:

    Example

    So what you are seeing is the discount price of 1000 kr..

    How can we achieve this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.