Advertisement
YordanSoares

PDF Invoices & Packing Slips for WooCommerce: Muestra el documento de identidad en la factura

Feb 9th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | Software | 0 0
  1. <?php
  2. /**
  3.  * PDF Invoices & Packing Slips for WooCommerce:
  4.  * Muestra el documento de identidad en la factura (si existe)
  5.  */
  6. add_action( 'wpo_wcpdf_after_billing_address', function( $document_type, $order ) {
  7.     if ( 'invoice' === $document_type ) {
  8.         // Intentamos obtener el número de NIF/DNI
  9.         $vat_number = $order->get_meta( '_billing_wooccm11' ) ?: $order->get_meta( 'billing_wooccm11' );
  10.         // ... si lo conseguimos, lo mostramos
  11.         if ( $vat_number ) {
  12.             echo '<div>DNI: ' . esc_html( $vat_number ) . '</div>';
  13.         }
  14.     }
  15. }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement