• Resolved mjke87

    (@mjke87)


    Hi,

    First off, thanks a lot for the great plugin.

    In our webshop we have different customer roles (B2B and B2C). For B2B customers the SKU and VAT per product is important, for B2C customer not.

    Therefore I’d like show the two columns based on the order type (B2B/B2C). The columns are already dynamically shown or hidden based on the template settings: bewpi_show_sku and bewpi_show_tax. However, there is no filter to modify this behavior more dynamically.

    Something like this would be really awesome (example SKU):

    
    // woocommerce-pdf-invoices/includes/templates/invoice/simple/micro/body.php:54
    <!-- SKU -->
    <?php $show_sku = $this->template_options['bewpi_show_sku'];
    <?php if ( apply_filters('bewpi_order_show_sku', $show_sku, $this->order ) { ?>
    	<?php $columns_count++; ?>
    	<th class="align-left"><?php _e( 'SKU', 'woocommerce-pdf-invoices' ); ?></th>
    <?php } ?>
    
    ...
    
    // woocommerce-pdf-invoices/includes/templates/invoice/simple/micro/body.php:122
    <?php $show_sku = $this->template_options['bewpi_show_sku'];
    <?php if ( apply_filters('bewpi_order_item_show_sku', $show_sku, $item, $this->order) { ?>
    	<td><?php echo ( $product && $product->get_sku() ) ? $product->get_sku() : '-'; ?></td>
    <?php } ?>
    

    Thank you for considering this new feature.

    Kind regards,
    Mike

Viewing 5 replies - 1 through 5 (of 5 total)
  • Does the code actually work?

    Plugin Author Bas Elbers

    (@baaaaas)

    I’ve created an Issue. Would be a great feature, but will investigate if there is a better way to filter ALL (visible columns) settings.

    Thread Starter mjke87

    (@mjke87)

    @filippossdr: It is just dummy code, but it illustrates the idea of having filterable columns.

    @baaaaas: That’s great news! You are right, a more generic approach would be more useful. My main problem was, that the template_options get loaded only once, early on, and are static thereafter. Perhaps creating a get_template_options function that takes the option key as parameter would be a possible solution. Inside of this function we could introduce a filter. This would allow to filter any kind of template option (I have also added this comment in Github).

    • This reply was modified 7 years, 9 months ago by mjke87.
    Plugin Author Bas Elbers

    (@baaaaas)

    Hi,

    This has been added. See below issue.
    https://github.com/baselbers/woocommerce-pdf-invoices/issues/190.

    hi can i change the form of the pdf from A4 to 80 mm epos pepper printer
    thank u

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filter for Invoice Columns’ is closed to new replies.