• Resolved bst7

    (@bst7)


    Hello,

    Is there some way we can remove the “Billing Address” on the Customer and our shop email notifications (as well as the display of the “Order Received” page?

    We are using Woo Commerce for our shopfront and only provide the PayPal checkout because they handle all of the billing and shipping address requirements for us (as well as payment of course).

    When we return from PayPal (for the user to complete the transaction) we are correctly displaying the billing name/email and shipping name/address on the webpage (“Confirm Your PayPal Order”)

    As you know, PayPal only returns Shipping Address. In our invoices (both to the customer and to us), and in the “Order Received” we have fields from the Woo Commerce system for both Shipping and Billing addresses. However, these are wrong if these names/addresses are different as PayPal only provides shipping address. Basically, what ends up being displayed for “Billing Address” is:
    Shipping Name
    Shipping Address
    Billing email

    “Shipping Address” is correctly displaying “Shipping Address”

    We are very happy to ONLY display Billing Name/Email and Shipping details on the “Confirm Your PayPal Order” as it is doing now.

    We want to remove the BILLING fields from the “Order Received”, Customer Invoice and Shop email notification of an order placed.

    The developed I am working with, seems to think this is not possible (or easy), so I thought I would ask here if there is anyway we can have Woo Commerce suppress this (incorrect) information.

    I have no desire (or requirement) to request billing information from PayPal at this stage.

    Thank you!

    William

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello @bst7 ,

    Okay, if I understand correctly, you do not want to show the billing address information in the emails and on the thank you/order received page. Is that right?

    First of all, the billing information in the email and in the thank you page is coming from these two locations.

    Email – wp-content/plugins/woocommerce/templates/emails/email-addresses.php
    You need to remove the lines from 41 to 47 and override this template in your theme to remove the billing information from emails.

    Similarly, to remove the billing information from the order received page, override this template –

    order received – wp-content/plugins/woocommerce/templates/orders/order-details-customer.php remove lines from 31 to 43.

    You can learn more about template overriding in WooCommerce here – Template structure & Overriding templates via a theme here

    I hope this information helps.

    Thank you ??

    Thread Starter bst7

    (@bst7)

    Thanks – I will take a look at this.

    Could this be an option in the plugin? We are exclusively using PayPal to handle our checkout and it only provides a Shipping Address, so, having a UI action “Only report Shipping Address” (or something like that) would be great. Otherwise, we are providing Customer Invoices with misleading information.

    Thread Starter bst7

    (@bst7)

    Thank you! Just a couple of tweaks to this.

    In email-addresses.php (line 29):
    The address in the email is now the Shipping (not Billing) address, so you should also change that:
    <h2><?php esc_html_e( ‘Billing address’, ‘woocommerce’ ); ?></h2>
    TO:
    <h2><?php esc_html_e( ‘Shipping address’, ‘woocommerce’ ); ?></h2>

    In order-details-customer.php, when you remove the “Billing Address”, the Shipping Address is still displayed in col 2. So, I think you remove:
    line 47 </div> (col 1)
    line 49 <div> (col 2)

    I also changed the <div> on line 27 to refer to the shipping (not billing) address

    That way, the Shipping Address is now aligned to the left (as it is the only address I am displaying).

    I have one more outstanding issue.
    In the Emailed Invoice, I get

    >>
    Hi Jay,

    Just to let you know — we’ve received your order #1793, and it is now being processed:
    >>>

    Where “Jay” is my Shipping Address name, but the email is actually going to my billing person, and should be displaying my billing name.

    In “customer-processing-order.php” it claims it is getting the get-billing-first-name:
    <p><?php printf( esc_html__( ‘Hi %s,’, ‘woocommerce’ ), esc_html( $order->get_billing_first_name() ) ); ?></p>

    But it is not, this is the Shipping First Name… Which really goes to the heart of the bugs here, that Woo Commerce is not dealing properly with this. It is weird, because in the “Confirm Your PayPal Order” page, it does correctly display both the Billing and Shipping names.

    I think at this point, I’d like to remove the “Hi Jay,” from the invoice, as it is incorrect. I presume I would just remove that line? (line 28 of customer-processing-order.php)

    Thanks again!

    William

    Thread Starter bst7

    (@bst7)

    Sorry for the additional response!

    It really would be better if I get somehow get the plugin to preserve the billing name (as it is from the “Confirm Your PayPal Order” page), so that it will use the correct name (and email) there.

    We see the correct Billing Name/Email in the email we get that provides the order details to us (the shop), it is just in the customer emails that this is wrong.

    Any idea why? Thanks!

    Hello @bst7 ,

    I am afraid, I did not get the full goal of the changes.

    If you want to have a enable/disable option as a plugin form, you will have to go for custom development. This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    If you need a paid solution, you can consider taking help from one of our partner’s website.

    Thank you ??

    Thread Starter bst7

    (@bst7)

    Hi Rashed

    Thanks for your response. The following is a general complaint – I appreciate your comments here, so this is not addressed to you.

    I really do not understand the poor integration between Woo Commerce and PayPal.

    PayPal returns BILLING NAME and EMAIL and full SHIPPING DETAILS.

    Woo Commerce then completely smashes the BILLING NAME and copies SHIPPING DETAILS to BILLING DETAILS. Huh!!!???

    What does this lead to? Bugs everywhere…

    Emails sent to the Biller, with “Hi SHIPPER” name.
    Emails sent to site admin and Biller with
    Shipping Details + BILLER email

    (admin-new-order, customer-order-processing, customer-order-complete) as well as any other customer email

    The Order itself is listed as the SHIPPER, but it is the BILLER who created the order. Even in the Order as listed, the Billing Details are the Shipping details. In the “fields” below, Payer details are still kept (but are never used in any templates)…!

    Woo Commerce it seems even tries to validate the Billing Address?!? It certainly don’t like having NO billing address. But how can it validate a billing address that is not even a billing address?!!!Imagine a scenario where you have a BILLER in US, SHIPPER in UK, what is WC Validating???

    It is a mess, and I really do not understand why WC even cares about a billing address in a simple transaction of making a payment for an order. The payment gateway is the only entity able to validate payer details. If a billing address is provided (or needed for account processes, etc), then fair enough, require it to be entered. But COPYING and WIPING OUT data (or making shit up) is just rubbish.

    It really should be sufficient for WC to work completely cleanly and reliably with:
    BILLER NAME
    BILLER EMAIL
    SHIPPING DETAILS

    (as a matter of interest, here is the offending code):
    $shipping_details = $this->get_mapped_shipping_address( $checkout_details );
    $billing_details = $this->get_mapped_billing_address( $checkout_details );

    // If the billing address is empty, copy address from shipping
    if ( empty( $billing_details[‘address_1’] ) ) {
    // Set flag so that WC copies billing to shipping
    $_POST[‘ship_to_different_address’] = 0;

    $copyable_keys = array( ‘first_name’, ‘last_name’, ‘address_1’, ‘address_2’, ‘city’, ‘state’, ‘postcode’, ‘country’ );
    foreach ( $copyable_keys as $copyable_key ) {
    if ( array_key_exists( $copyable_key, $shipping_details ) ) {
    $billing_details[ $copyable_key ] = $shipping_details[ $copyable_key ];
    }
    }
    } else {
    // Shipping may be different from billing, so set flag to not copy address from billing
    $_POST[‘ship_to_different_address’] = 1;
    }

    This is from
    woocommerce-gateway-paypal-express-checkout
    Includes
    class-wc-gateway-ppec-checkout-handler.php

    And is no doubt there to workaround the fact that WC insists on having a billing address.

    Oh, and the actual value of $_POST[‘ship_to_different_address’] seems to be completely ignored.

    The code OVERWRITES biller’s name… disgraceful (to be blunt).

    Bill

    Hello @bst7 ,

    I understand you are not happy regarding how WooCommerce billing details.

    If you have a suggestion regarding how shipping and billing is returned from Paypal, you can submit your suggestion here – https://github.com/woocommerce/woocommerce

    I am sure the developers will love to explain how the information is handled.

    Thank you ??

    Plugin Support EtienneP a11n

    (@etiennep)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide Billing Address in Invoice/Email’ is closed to new replies.