Support » Plugin: Print Invoice & Delivery Notes for WooCommerce » Hide Shipping Address

  • Resolved mysticminimalistartisan

    (@mysticminimalistartisan)


    Hi. I have a service based business so I would like to hide the shipping address on the page that loads when clicking the “Open print view in browser” link in the e-mail. From the FAQ I have tried the

    function example_removed_payment_method( $fields ) {
        unset( $fields['payment_method'] );
        return $fields;
    }
    add_filter( 'wcdn_order_info_fields', 'example_removed_payment_method' );

    but I don’t know what to change the “example_removed_payment_method” & “payment_method” to.

    Also, I would like to change the color of the print button at the bottom to a more noticeable color so people see it better as it is easy to overlook (& my site color just happens to be the perfect color, LOL!). I have used the inspector & see it is defined by #navigation .button, but I can’t find this in the stylesheet. How can I change the color of the button?

    I would really appreciate any help. Love the plugin by the way, thanks for creating it!!!

Viewing 15 replies - 1 through 15 (of 42 total)
  • moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    For hiding the shipping address, please add the below code in your active theme’s functions.php file or use a plugin like Code Snippets:

    function example_removed_shipping_address( $order ) {
    if ( ! $order->get_formatted_shipping_address) {
    	esc_attr_e( 'N/A', 'woocommerce-delivery-notes' );
    }
    }add_filter( 'wcdn_address_shipping', 'example_removed_shipping_address' );

    Screenshot:- https://prnt.sc/cTS6xnJt8UBn

    You can change the color of the print button directly in the file.
    path:- woocommerce-delivery-notes/includes/class-wcdn-theme.php

    <p class="order-print">
    <a href="<?php echo esc_url( $print_url ); ?>" class="button print" style="background-color:red"><?php echo esc_attr( apply_filters( 'wcdn_print_button_name_order_page', __( 'Print', 'woocommerce-delivery-notes' ), $order ) ); ?></a>
    </p>

    Screenshot:- https://prnt.sc/lDm82x2aKWtT

    Please note that updating the plugin’s new version will wipe out these changes.

    Regards,
    Moksha.

    • This reply was modified 1 year, 8 months ago by moksha shah.
    • This reply was modified 1 year, 8 months ago by moksha shah.
    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Weird, I just received a reply to this post, but there’s no reply here. It was from moksha shah.

    Anyways, I added the functions to my themes function file, but I get the following eror:

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

    syntax error, unexpected ‘&’

    I have no idea which & to remove. Help? Thanks!

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Weird, now your reply is here @mokshasharmila13 so strange. Anyways, after copying it from your reply instead of the e-mail, it worked, BUT, it didn’t hide the shipping address. It’s still there, it just says Shipping Address N/A

    I did clear cache on both my browser & on the website.

    Not sure what I did wrong?

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    Please can you show me your code, because in our code this sign ‘&’ is not used. Check it and paste the code once again and let us know.

    Regards,
    Moksha.

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    You can directly remove or comment ‘shipping address’ from the file print-content.php Or directly just replace the below file in the given path.

    Please note that updating the plugin’s new version will wipe out these changes.

    File path:- woocommerce-delivery-notes/templates/print-order
    File:- https://www.dropbox.com/s/elzpr1fbl9655xw/print-content.php?dl=0

    Please take a backup of the existing plugin before you replace the above files.

    Regards,
    Moksha.

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    This is the code I pasted:

    function example_removed_shipping_address( $order ) {
    if ( ! $order->get_formatted_shipping_address) {
    	esc_attr_e( 'N/A', 'woocommerce-delivery-notes' );
    }
    }add_filter( 'wcdn_address_shipping', 'example_removed_shipping_address' );

    Isn’t there a way I could just have it not show with css? I have tried

    .shipping-address {
    	display: none !important;;
    }

    but it doesn’t work either. I’d really rather not edit the plugin files, although if it’s a template, shouldn’t I be able to copy the template file to my child theme so I don’t lose changes with updates?

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Oops, I noticed the extra ; in the css & removed it, but it still doesn’t work.

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    Please check we have given one more solution for hiding the shipping address (read my last reply) . Replace the file and let us know.

    Regards,
    Moksha.

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    I uploaded the file, cleared caches on both sides, but it did not work.

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    For hiding the shipping address replace the below file in the given path and let us know.
    Please note that updating the plugin’s new version will wipe out these changes.

    File path:- woocommerce-delivery-notes/templates/print-order
    File:- https://www.dropbox.com/s/elzpr1fbl9655xw/print-content.php?dl=0

    Please take a backup of the existing plugin before you replace the above files.`

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Is this the same one you had me download before or did you change something in it? If it’s the same one, I already uploaded it. If it’s different let me know & I’ll try it. Thanks.

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    Yes, we have resolved the issue and sent you the file. Replace this file and let us know.

    Regards,
    moksha.

    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Nope, it still isn’t gone.

    moksha shah

    (@mokshasharmila13)

    Hi @mysticminimalistartisan,

    Please remove all the changes which you have done before and replace the file. We are sharing the screenshot. You can directly remove or comment on the whole code of ‘shipping address’ from the file print-content.php. Please check once again and let us know.

    Please download the file once again and replace it.

    Screenshot:- https://prnt.sc/mOk8tpKGeihu

    File path:- woocommerce-delivery-notes/templates/print-order
    File:- https://www.dropbox.com/s/elzpr1fbl9655xw/print-content.php?dl=0

    Please take a backup of the existing plugin before you replace the above files.

    Regards,
    Moksha.

    • This reply was modified 1 year, 8 months ago by moksha shah.
    • This reply was modified 1 year, 8 months ago by moksha shah.
    Thread Starter mysticminimalistartisan

    (@mysticminimalistartisan)

    Are you talking about removing the code you gave me for functions.php? If you are, I had already done that before.

    I downloaded the file again & uploaded it again but I am still seeing the shipping address. After uploading the file, I cleared my browser cache, cleared the cache in wordpress and I also regenerated the invoice e-mail from the order.

    Here is a screenshot (I took out my clients billing address & phone): https://drive.google.com/file/d/1ncyQx85WiwDbXpUU9IdQcq5qLhB-aePC/view?usp=sharing

Viewing 15 replies - 1 through 15 (of 42 total)
  • The topic ‘Hide Shipping Address’ is closed to new replies.