• Again thanks for the great plugin!
    I am printing orders on a thermal printer, configured with CSS (@media print).
    Everything works fine but I have 3 products where the name is too long (31 characters without spaces) and when I print, the “product” column becomes so wide that the “total” column doesn’t print.
    I tried to change the column widths with CSS but without success ??
    Does anyone have a solution?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Here’s a filter that can set the long size of the product name. Add this code snippet in functions.php file of your currently active theme.

    function custom_wcdn_order_item_name($product_name, $item) {
        if (strlen($product_name) > 5) {
            $product_name = '<span class="wrap-product-name">' . esc_html($product_name) . '</span>';
        } else {
            $product_name = '<span>' . esc_html($product_name) . '</span>';
        }
        return $product_name;
    }
    add_filter('wcdn_order_item_name', 'custom_wcdn_order_item_name', 10, 2);

    After this, please follow the below steps.
    1. Download the CSS file in this link –?https://www.dropbox.com/scl/fi/ga0a1qyw9wx8l6xinggpe/style.css?rlkey=itdzbmuu3vfuqewxka4zwluh0&dl=0
    2. After downloading the file, you can replace it with the original file in the \wp-content\plugins\woocommerce-delivery-notes\templates\print-order folder.
    3. The css makes the necessary changes to fix the name in 80mm thermal printer.

    Screenshot for your reference:?https://prnt.sc/d50hroi1AG_c

    Please let me know if the provided solution resolves your issue.

    Regards,
    Nikhil.

    Thread Starter norisknofun11

    (@norisknofun11)

    thank you very much! it works perfectly.
    however, I preferred to put the change in the style.css file in a snippet function

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘thermal printer columns width’ is closed to new replies.