Plugin Contributor
Ewout
(@pomegranate)
Hi! You can do this by applying the following filter:
// add the filter only when creating a pdf
add_action( 'wpo_wcpdf_before_pdf', 'wpo_wcpdf_set_decimals' );
function wpo_wcpdf_set_decimals ( $template_type ) {
add_filter( 'wc_price_args', 'wpo_wcpdf_decimals_filter' );
}
function wpo_wcpdf_decimals_filter( $args ) {
$args['decimals'] = 2;
return $args;
}
// clean up after ourselves
add_action( 'wpo_wcpdf_after_pdf', 'wpo_wcpdf_unset_decimals' );
function wpo_wcpdf_unset_decimals ( $template_type ) {
remove_filter( 'wc_price_args', 'wpo_wcpdf_decimals_filter' );
}
Read this if you haven’t worked with filters before: How to use filters
Hope that helps!
Ewout
-
This reply was modified 9 years, 7 months ago by
Ewout.
Thread Starter
db306
(@db306)
Hi there,
Thanks for the reply. Your solution works perfectly, however it doesn’t seem to work on products (see screenshot)

-
This reply was modified 9 years, 6 months ago by
db306.
Plugin Contributor
Ewout
(@pomegranate)
It looks to me like this is an issue with the WooCommerce calculation settings rather than with the display settings, do you see the correct product price in the order backend? (maybe share a screenshot of the order details?)
Thread Starter
db306
(@db306)
Hi there,
I enter the price of the product including tax. On the backend the prices show up as rounded with no decimals. However I have a Point of Sale plugin that does display the correct price (with decimals) so I would suppose that the product on the invoice is display the rounded price with decimals.
Plugin Contributor
Ewout
(@pomegranate)
Hi! I don’t know where the POS plugin stores/gets its data, but if the price in the order is already rounded, there’s no way the PDF invoice plugin can undo that – it can only show decimals that are there. My guess is that the rounded prices are used during checkout and also stored that way.
You could do a double check and install the WooCommerce Toolkit plugin (free) and then see if you see the full prices under “order items postmeta”. If you do, that does offer perspective.