Home › Forums › WoodMart support forum › free shipping bar sometimes show up and sometimes doesn’t › Reply To: free shipping bar sometimes show up and sometimes doesn’t
October 5, 2022 at 6:36 am
#410778
qtwrk555
Participant
I worked out this code snippet that fill the shipping addr from billing addr after first check
add_action('woocommerce_thankyou', 'copy_bill_to_ship', 10, 1);
function copy_bill_to_ship(){
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$shipping_first_name = get_user_meta( $current_user->ID, 'first_name', true );
$shipping_last_name = get_user_meta( $current_user->ID, 'last_name', true );
$shipping_company = get_user_meta( $current_user->ID, 'billing_company', true );
$shipping_address_1 = get_user_meta( $current_user->ID, 'billing_address_1', true );
$shipping_address_2 = get_user_meta( $current_user->ID, 'billing_address_2', true );
$shipping_city = get_user_meta( $current_user->ID, 'billing_city', true );
$shipping_postcode = get_user_meta( $current_user->ID, 'billing_postcode', true );
$shipping_state = get_user_meta( $current_user->ID, 'billing_state', true );
$shipping_country = get_user_meta( $current_user->ID, 'billing_country', true );
update_user_meta( $user_id, "shipping_first_name", $shipping_first_name );
update_user_meta( $user_id, "shipping_last_name", $shipping_last_name );
update_user_meta( $user_id, "shipping_company", $shipping_company );
update_user_meta( $user_id, "shipping_address_1", $shipping_address_1 );
update_user_meta( $user_id, "shipping_address_2", $shipping_address_2 );
update_user_meta( $user_id, "shipping_city", $shipping_city );
update_user_meta( $user_id, "shipping_state", $shipping_state );
update_user_meta( $user_id, "shipping_postcode", $shipping_postcode );
update_user_meta( $user_id, "shipping_country", $shipping_country );
}
it seems works for my expectation , but still want it to be fixed natively 🙂