I couldn’t successfully create a dynamic tag to query woocommerce billing phone number.
Another question is, must the user role be customer? Because there are other roles with access to woocommerce shop and also have woocommerce billing info set.
add_filter( 'bricks/code/echo_function_names', function() {
return [
'get_user_meta', // Allow calling get_user_meta() function
];
} );
function get_user_billing_phone_number() {
// Get the current user's ID
$user_id = get_current_user_id();
// Check if the user is logged in
if ( $user_id ) {
// Get the user's billing phone number
$billing_phone = get_user_meta( $user_id, 'billing_phone', true );
// Return the billing phone number
return $billing_phone;
}
// If the user is not logged in or the phone number is not available, return an empty string
return '';
}
And then attempted this to out the info
{echo:get_user_billing_phone_number()}
PS: @bricksultimate
You guys dynamic tag to query customer billing info ain’t working too.