Hi @nicado,
Thank you for sharing your requirement.
I will discuss this requirement with the development team. I will let you know the update on the same as soon as I hear back on this from the dev team. I hope that is fine.
Hi @nicado,
Our developer has provided a tailored solution that applies the 80mm receipt size specifically to receipt templates, while leaving A4 invoices unaffected. The approach involves checking the template type and applying custom CSS only when printing receipts. However, you will need to adjust the code as per your 58mm size.
Please update your active theme’s “functions.php” with the following code to achieve your requirement:
function print_paper_resize() {
$template_type = wcdn_get_template_type();
if ( $template_type === 'receipt' ) {
?>
<style>
/* CSS Media Queries for Print
------------------------------------------*/
@media print {
body {
font-size: 8.5pt;
max-width: 80mm;
margin: auto!important;
font-weight: 550;
}
.shipping-address{
width:80%!important;
}
.billing-address{
width:70%!important;
margin-bottom:1em!important;
}
h2,h3{
margin-bottom:0!important;
}
th{
padding-bottom:0!important;
padding-left:0.5em!important;
}
td{
padding:0.35em 0.35em 0!important;
}
.order-addresses{
margin-bottom:1em!important;
}
.order-info li strong {
font-weight:600!important;
display:inline!important;
padding-right:1.4em!important;
}
.order-info{
margin-bottom:0!important;
}
.order-branding{
margin-bottom:0!important;
}
.product-quantity, .total-quantity{
padding-left:1.8em!important;
}
.includes_tax {
white-space:nowrap!important;
}
.content {
/* Remove padding to not generate empty follow up pages */
padding-bottom: 0;
}
}
</style>
<?php
}
}
add_action( 'wcdn_head', 'print_paper_resize', 10, 1 );
Also, you need to adjust the CSS selectors based on your theme’s HTML structure for precise targeting.
Feel free to implement this solution and let us know if it meets your needs or if you require further customization.