• Resolved pomegranates

    (@pomagaj)


    Almost 2 years ago you provided a code snippet to remove weight like this:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
    function wpo_wcpdf_custom_styles ( $document_type, $document ) {
    ?>
    .product .meta .weight { display: none; }
    <?php
    }

    This code stopped working months ago, after one of the updates.

    Can you share a new code?

    Thanks in advance for help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @pomagaj,

    We have applied several changes to the PDF documents to make them compatible with the PDF engines we use (dompdf and mPDF), and this has changed the document structure a bit, including the CSS selectors.

    That said, the following code snippet should work for you:

    /**
    * PDF Invoices & Packing Slips for WooCommerce
    * Apply custom styles to the PDF documents
    */
    add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {
    ?>
    /* Hide the weight in all PDF documents */
    .item-meta .weight { display:none }
    <?php
    }, 10, 2 );

    Let me know whether it worked or not!

    Thread Starter pomegranates

    (@pomagaj)

    Yes, this code works. Thank you very much!

    l1ghtning

    (@barisyildirimc)

    Hello, how can I hide all the meta fields of the product only for the Packing Slip document? A plugin that allows me to make measurements writes the price in these meta fields and I don’t want it to write the price in this document.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @barisyildirimc,

    Try with this code snippet that I just wrote for you:

    /**
    * PDF Invoices & Packing Slips for WooCommerce
    * Apply custom styles to the PDF packing slip
    */
    add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {
    if ( 'packing-slip' === $document_type ) {
    ?>
    /* Hide item meta from packing slip */
    .item-meta { display:none }
    <?php
    }
    }, 10, 2 );

    P.S.: Please open a new topic, if you have more questions! 😉

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Remove weight from Pack & Inv’ is closed to new replies.