Skip to content

Instantly share code, notes, and snippets.

@rawars
Created October 17, 2020 16:24
Show Gist options
  • Save rawars/48644f0586eec58c869371706f9201c9 to your computer and use it in GitHub Desktop.
Save rawars/48644f0586eec58c869371706f9201c9 to your computer and use it in GitHub Desktop.
Auto fill wordpress checkout form.
```
add_filter( 'woocommerce_checkout_get_value' , 'custom_checkout_get_value', 20, 2 );
function custom_checkout_get_value( $value, $imput ) {
// Billing first name
if(isset($_GET['FirstName']) && ! empty($_GET['FirstName']) && $imput == 'billing_first_name' )
$value = esc_attr( $_GET['FirstName'] );
// Billing last name
if(isset($_GET['LastName']) && ! empty($_GET['LastName']) && $imput == 'billing_last_name' )
$value = esc_attr( $_GET['LastName'] );
// Billing email
if(isset($_GET['EmailAddress']) && ! empty($_GET['EmailAddress']) && $imput == 'billing_email' )
$value = sanitize_email( $_GET['EmailAddress'] );
// Individual 4968
// Familiar 4967
return $value;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment