• Resolved katfrajoe

    (@katfrajoe)


    Is it possible to make the amount of products ordered on the packing slip red if there are more then one?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Yes, this is certainly possible, but it requires some customization on the output, using a small code snippet:

    
    add_filter( 'wpo_wcpdf_order_item_data', 'wpo_wcpdf_quantity_color', 10, 3 );
    function wpo_wcpdf_quantity_color( $item, $order, $template_type ) {
    	if ( intval( $item['quantity'] ) > 1 ) {
    		$item['quantity'] = sprintf('<span style="color:red;font-weight:bold;">%s</span>', $item['quantity'] );
    	}
    	return $item;
    }
    

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

    Alternatively, if you want a simpler solution that requires no coding, you may consider purchasing our Premium Templates extension. In that case you can simply add this to the “Custom Styles” setting on the Customizer tab:

    
    .quantity.multiple {
      color: red;
      font-weight: bold;
    }
    

    or, if you want to limit this to the packing slip:

    
    .packing-slip .quantity.multiple {
      color: red;
      font-weight: bold;
    }
    

    Hope that helps!

    Thread Starter katfrajoe

    (@katfrajoe)

    Thanks, I have another snippet which sets it in bold.

    Looks like that’s the only one working for the packing slips.

    • This reply was modified 4 years, 2 months ago by katfrajoe.
    Plugin Contributor Ewout

    (@pomegranate)

    The above snippet should work fine as well (but already sets it in bold too, so you only need this one)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Amount of products red’ is closed to new replies.