• Resolved pete4mask

    (@pete4mask)


    Hi
    I’d like the colour, size & SKU (etc) for each item to display on a single line if possible.

    Main reason is to reduce number of pages needed for a packing slip.
    I mainly use the packing slip for picking the order and only send an invoice with the order.

    Other option is all the attributes (colour, size) on one line and potentially the SKU could precede the tile/desc?

    If you could point me to the function that handles this I’m happy to play around to find a setup that works for me.

    • This topic was modified 2 years, 8 months ago by pete4mask.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @pete4mask,

    You can achieve this by adding CSS rules, through the wpo_wcpdf_custom_styles action hook, this way:

    /**
     * WooCommerce PDF Invoices & Packing Slips:
     * Display the item meta inline in the packing slip
     */
    add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {	
    	if ( $document_type == 'packing-slip' ) {
    		?>
    		.wc-item-meta li {
    			display: inline-block;
    		}
    		<?php
    	}
    }, 10, 2 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Thread Starter pete4mask

    (@pete4mask)

    Awesome, thanks!

    I had found a snippet on here when looking for an answer which removes the weight, so I have combined the two solutions and removed the attributes altogether because they are added to the title and implied in the SKU

    /**
     * WooCommerce PDF Invoices & Packing Slips:
     * Display the item meta inline in the packing slip
     */
    add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {	
    	if ( $document_type == 'packing-slip' ) {
    		?>
            	dt.weight,
        	        dd.weight,
    		.wc-item-meta li {
    	//	display: inline-block;
        		display: none;
    		}
    	<?php
    	}
    }, 10, 2 );

    So I get output like this

    Waterproof Glove – XS/S, Black
    SKU: GG1074-2

    Cheers
    Pete

    • This reply was modified 2 years, 8 months ago by pete4mask.
    • This reply was modified 2 years, 8 months ago by pete4mask.
    • This reply was modified 2 years, 8 months ago by pete4mask.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to hear you find out how to set it up as you wanted!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Packing Slip: How to display product attributes, SKU on single line’ is closed to new replies.