Support » Plugin: YITH WooCommerce PDF Invoice and Shipping List » Remove columns from pdf invoices for a certain product

  • Fran

    (@franfal)


    Hello,

    I want to remove some columns such as (price, quantity, rates, discounts…) from my pdf invoices, only for products that belong to a certain category.

    Is there any way to do this?

    Is there a hook I can use?

    Thank you and Best Regards

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hello there,
    hope you are doing well! 🙂

    You can achieve it overriding the plugin templates in your theme, but this customization falls outside our WordPress.org support policy.

    Anyway, we can give you a hint to achieve it. You have to copy the plugin template located in “/plugins/yith-woocommerce-pdf-invoice/templates/invoice/invoice-details.php” inside your theme “/themes/your_theme_name/woocommerce/invoice/invoice-details.php” and here you can make the customization you need.

    Then, inside this template, you can add a condition to check the product categories and the columns you want to hide for these products. For example, if you want to hide the “price” column for the category ID = 28, you can use the next code.

    
     $categories = $product->get_category_ids();
    
            if ( ! in_array( '28', $categories )){
                ?><th class="column-price"><?php _e ( 'Price', 'yith-woocommerce-pdf-invoice' ); ?></th><?php
            }

    Check it and let us know any news.

    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘Remove columns from pdf invoices for a certain product’ is closed to new replies.