Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto check Create account field in Woocommerce Checkout Page

I am using woocommerce for a wordpress site and I would like for users to create an account during the checkout process when entering in payment details. Normally there is checkbox option that users must physically click to make an account.

Is there some implementation that can have this "create an account" box pre-checked and all users have to do is create a password.

(http://imgur.com/lANhCfn)

(http://imgur.com/qyfs4fy)

like image 396
Dontae Carter Avatar asked Dec 19 '22 22:12

Dontae Carter


1 Answers

Checkout Require Create Account

Checkbox Behavior

Use the woocommerce_create_account_default_checked filter

add_filter('woocommerce_create_account_default_checked' , function ($checked){ return true; });

Place it in your theme or child theme's functions.php

Alter Template

Hide the checkbox and its label by overriding the woocommerce template. You do so by copying the form-billing.php file to your theme's folder.

Add a hidden attribute to the input tag and delete the label tag.

<input hidden class="..." ...

like image 96
Scriptonomy Avatar answered Feb 01 '23 14:02

Scriptonomy