• Resolved tosh11formula

    (@tosh11formula)


    what Is the best way to add an white space css here.

    add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_product_custom_field', 10, 3 );
    function wpo_wcpdf_product_custom_field ( $template_type, $item, $order ) {
        // check if product exists first
        if (empty($item['product'])) return;
      
        // replace 'Location' with your custom field name!
        $field_name = 'package_inclusion';
        $package = $item['product']->get_meta($field_name,true,'edit');
        if (!empty($package)) {
            echo '<div class="product-package">Package Inclusion'.$package.'</div>';
        }
    }
    

    Because I want to set up this settings to PDF. kindly see attached

    https://ibb.co/vwKHJNp

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    I think what you are looking for is nl2br():

    
    add_action( 'wpo_wcpdf_after_item_meta', function( $template_type, $item, $order ) {
        // check if product exists first
        if ( empty( $item['product'] ) ) return;
    
        $field_name = 'package_inclusion';
        if ( $package = $item['product']->get_meta( $field_name ) ) {
            echo '<div class="product-package">Package Inclusion<br>' . nl2br( $package ) . '</div>';
        }
    }, 10, 3 );
    
Viewing 1 replies (of 1 total)

The topic ‘White Space Meta’ is closed to new replies.