• Resolved richsadams

    (@richsadams)


    This is a great plugin and does almost exactly what I need it to do. There is one modification I would like to make.

    I want to hide the billing address on printed orders and invoices so that they only show the shipping address.

    I can do this by modifying the following code in the plugin’s templates > print-order > style.css file by adding “visibility: hidden;” to line #165 directly:

    .billing-address {
    width: 50%;
    float: left;
    visibility: hidden;
    }

    That works perfectly. However I want to add this modification to my child theme to avoid any issues when the plugin is updated.

    Would you be so kind as to let me know the best way to do this?

    TIA!

    • This topic was modified 5 years, 2 months ago by richsadams.
    • This topic was modified 5 years, 2 months ago by richsadams.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter richsadams

    (@richsadams)

    A follow-up to my earlier note. After some experimentation, to hide the billing field I added the following code to my child theme’s functions.php file:

    /* Changes WC billing and shipping print receipt, invoice and shipping to hide billing address on print */

    function hide_billing_address() {
    ?>
    <style>
    .billing-address {
    display: none;
    }
    </style>
    <?php
    }
    add_action( ‘wcdn_head’, ‘hide_billing_address’, 20 );

    This hides the billing field and causes the shipping field to display in its place.

    I’d prefer the shipping field display on the right-hand side as it did previously when I changed the code in the style.css file. So if you have some additional advice on that I’d appreciate it.

    Thanks very much!

    Plugin Support kenil802

    (@kenil802)

    Hi @richsadams,

    Thank you for sharing the code.

    Regarding your query, can you please try by adding the following CSS in the above code which you have provided? This will display the shipping address on the right-hand side.

    CSS Code:
    float:right css;

    Let us know how it goes.

    Regards,
    Kenil Shah

    Thread Starter richsadams

    (@richsadams)

    @kenil.

    Thank you very much for that. I tried the suggested code (and a couple of variations), however it did not move the shipping address to the right (although I wouldn’t expect it to as it is addressing the billing address which is hidden by the same code)

    Based on your suggestion and after some more experimentation I was able to move the shipping address to the right by adding the following code to the child theme’s functions.php file:

    function move_shipping_address() {
    ?>
    <style>
    .order-addresses .shipping-address {
    float: right;
    }
    </style>
    <?php
    }
    add_action( ‘wcdn_head’, ‘move_shipping_address’, 20 );

    So in total I was able to hide the billing address and display the shipping address on the right-hand side of the printed invoices, customer notes and receipts by adding this code to my child theme’s functions.php file:

    /* Changes WC billing and shipping print receipt, invoice and shipping to hide billing address on print */
    function hide_billing_address() {
    ?>
    <style>
    .billing-address {
    display: none;
    }
    </style>
    <?php
    }
    add_action( ‘wcdn_head’, ‘hide_billing_address’, 20 );

    /* Changes WC billing and shipping print receipt, invoice and shipping to display shipping address to the right on print */
    function move_shipping_address() {
    ?>
    <style>
    .order-addresses .shipping-address {
    float: right;
    }
    </style>
    <?php
    }
    add_action( ‘wcdn_head’, ‘move_shipping_address’, 20 );

    Would you be so kind as to confirm that this additional code will not cause any problems with your plugin, WooCommerce or the overall site’s operation if you can?

    Thank you again for your great plugin and support!

    Plugin Support kenil802

    (@kenil802)

    Hi @richsadams,

    Thank you for appreciating our plugin and sharing the detailed information.

    Regarding your query, by adding the additional code to the child theme’s functions.php file, will not impact anything on the site or plugin as the code added in the function is only based on the CSS and not anything else.

    Regards,
    Kenil Shah

    Thread Starter richsadams

    (@richsadams)

    @kenil,

    Thanks very much and keep up the great work!

    Best wishes,

    Rich

    • This reply was modified 5 years, 2 months ago by richsadams.
    Plugin Support kenil802

    (@kenil802)

    Hi @richsadams,

    You are welcome.

    Happy to help!

    Regards,
    Kenil Shah

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide Billing Address on Print’ is closed to new replies.