• Resolved TallSam

    (@tallsam)


    I have a lot of product options and these are cluttering up my invoices and packing slips. Is there an option not to include product options on the pdfs?

    Note that I’m using a plugin called Advanced Product Fields Pro for WooCommerce to get more detailed product options.

    Thanks,
    Sam

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hi @tallsam

    You should be able to hide those using the code snippet below in your functions.php file:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
        ?>
        .table.order-details .wc-item-meta { display: none; }
        <?php
    }

    If you never worked with actions/filters please read this documentation page: How to use filters

    Thread Starter TallSam

    (@tallsam)

    I’m getting the following error with that code:

    Your PHP code changes were rolled back due to an error on line 53 of file wp-content/themes/customizr-child/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘&’

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @tallsam

    The error is not from my snippet, should be elsewhere. You can look at your functions.php file, on line 53, to see which snippet is triggering that error.

    Thread Starter TallSam

    (@tallsam)

    Curious, wordpress was not like the ‘ symbol, it was changing it to something with an & symbol. Not this time though, got your code into the functions.php file fine.

    The invoice pdf is still showing all the options though…

    Plugin Contributor Ewout

    (@pomegranate)

    I believe there was a small error in the code, can you replace this:

    
        .table.order-details .wc-item-meta { display: none; }
    

    by:

    
        table.order-details .wc-item-meta { display: none; }
    

    (removing the . at the beginning)

    Thread Starter TallSam

    (@tallsam)

    That worked, thanks.

    Is there a way to selectively not show some items but do show others?

    Thanks again,
    Sam

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @tallsam

    Sorry for my typo error.

    Is there a way to selectively not show some items but do show others?

    It’s possible, but doesn’t have much flexibility because if the order changes the result could be not the ideal. Anyway, you can do it using this class selector :nth-child() like below:

    .wc-item-meta > li:nth-child(2) { display:none; }
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove product options from pdfs?’ is closed to new replies.