• Resolved tpark

    (@tpark)


    how do i get single product regular price?
    <?php echo $item['ex_single_price']; ?>
    the code above must return single regular price before discount, but it returns the single price after discount in the invoice.php.

    Thank you

    ps: i know you have premium pdf template that provide invoice customization, but i didn’t need all premium features, i just want regular price before discount.

    • This topic was modified 7 years, 2 months ago by tpark.
    • This topic was modified 7 years, 2 months ago by tpark.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello,
    Just to avoid confusion, are you talking about the ‘regular price’ (for a product on sale) or about the price before a discount (coupon) is applied? The regular price is not stored in the order and if you don’t want to use the premium templates, you’ll have to load the product object first and use that to retrieve the regular price. For the pre-discount single price you can use $item['single_line_total'].

    Happy New Year!
    Ewout

    Thread Starter tpark

    (@tpark)

    Hi dear @pomegranate,
    Happy new year

    here is my code:

    <?php echo $item['price']; ?><!-- single item Original price (before applying any coupon code or sale/discounts) |not-working|-->
    <?php echo $item['single_line_total']; ?><!--single item Sale price |Working| -->
    <?php echo $item['line_total']; ?><!-- sale total |Working| -->
    Plugin Contributor Ewout

    (@pomegranate)

    $item['price'] is the total price (single price * qty), before discount, including tax. As I wrote in the post above, WooCommerce does not store ‘regular’ prices in the order (or the cart for that matter), only when a discount is applied there is a difference between the before and after discount price. Sale prices are not considered as discounts by WooCommerce and therefor also not stored in the order. You will need to get this information from the product (and then copy it to the order, because product prices can change and the order should not).

    If you need more help with this, I recommend finding a programmer that knows WooCommerce or getting the Premium Templates extension (which requires no programming and comes with additional support when required).

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get the single Regular price’ is closed to new replies.