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!
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
@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!
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
@kenil,
Thanks very much and keep up the great work!
Best wishes,
Rich
-
This reply was modified 6 years, 7 months ago by
richsadams.