Advertisement
YordanSoares

PDF Invoices & Packing Slips for WooCommerce: Replace color square with "(Color Preview)"

Jan 23rd, 2024
1,002
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | Software | 0 0
  1. <?php
  2. /**
  3.  * PDF Invoices & Packing Slips for WooCommerce:
  4.  * Replace color square with "(Color Preview)" on the PDF documents
  5.  */
  6. add_filter( 'wpo_wcpdf_get_html', function( $html, $document ) {
  7.     $html = str_replace( '■', '(Color Preview) ', $html );
  8.     $html = str_replace( '&#9632;', '(Color Preview) ', $html );
  9.     return $html;
  10. }, 10, 2);
  11.  
  12. // Alternative code to remove the square altogether (please choose just one code snippet!):
  13.  
  14. /**
  15.  * PDF Invoices & Packing Slips for WooCommerce:
  16.  * Remove color square from the PDF documents
  17.  */
  18. add_filter( 'wpo_wcpdf_get_html', function( $html, $document ) {
  19.     $html = str_replace( '■', '', $html );
  20.     $html = str_replace( '&#9632;', '', $html );
  21.     return $html;
  22. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement