Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Jensen

    (@dkjensen)

    Hello

    Are you referring to showing both the sale price AND the regular price on the PDF?

    If a product is on sale and in the cart, the PDF will show the sale price.

    Thread Starter gvangvalo

    (@gvangvalo)

    yes i need showing both the sale price AND the regular price on the PDF

    Plugin Author David Jensen

    (@dkjensen)

    Ok so the first thing you’ll need to do is copy the cart-table.php file from the plugin to your child-theme/woocommerce/wc-cart-pdf/cart-table.php.

    You can find the template code here.

    Then you can modify the cart-table.php file within your child theme, this will prevent your modifications from being overridden when updating the plugin.

    In the cart-table.php file within your child theme, edit lines 110-112, to look like the following:

    <?php
        $on_sale       = $_product->is_on_sale();
        $regular_price = $_product->get_regular_price();
        $sale_price    = $_product->get_sale_price();
    
        if ( $on_sale && ( $sale_price < $regular_price ) ) {
            echo apply_filters( 'woocommerce_cart_item_price', apply_filters( 'woocommerce_cart_product_price', wc_format_sale_price( $regular_price, $sale_price ), $_product ), $cart_item, $cart_item_key ); // phpcs:ignore
        } else {
            echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // phpcs:ignore
        }
    ?>

    It should look like this:

    View Full Image

    • This reply was modified 11 months, 3 weeks ago by David Jensen.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘price’ is closed to new replies.