admin管理员组文章数量:1289423
I use wordpress and woocommerce to sell online courses. also I use "digits" plugin to make users able to order and create accounts using only their mobile phone numbers and therefore, email is not needed and I have removed email field from checkout using "checkout filed editor" plugin.
But woocommerce creates download links based on user emails, therefore download links are invalid for users after they buy something and want to download it. because of that, I have to manually add an email like "[email protected]" to every order and revoke download links of that order to make download links work.
the question is : how to automatically add "[email protected]" to email field of every order when users order something?
I use wordpress and woocommerce to sell online courses. also I use "digits" plugin to make users able to order and create accounts using only their mobile phone numbers and therefore, email is not needed and I have removed email field from checkout using "checkout filed editor" plugin.
But woocommerce creates download links based on user emails, therefore download links are invalid for users after they buy something and want to download it. because of that, I have to manually add an email like "[email protected]" to every order and revoke download links of that order to make download links work.
the question is : how to automatically add "[email protected]" to email field of every order when users order something?
Share Improve this question asked Jul 17, 2021 at 15:04 ErfanErfan 35 bronze badges 2- Do you want the user to be able to change that value? or is it fixed no matter what? – Buttered_Toast Commented Jul 18, 2021 at 7:18
- A fixed and constant value no matter what. – Erfan Commented Jul 18, 2021 at 11:22
1 Answer
Reset to default 0In order to achive that you only need two woocommerce filters.
First we remove the email post field from the checkout form.
Second we set the the submited form data, email, to some fixed value.
This is the whole code, paste it into functions.php
and you are good to go. Don't forget to change the email to what ever you need.
add_filter('woocommerce_checkout_fields', 'bt_manipulate_checkout_fields');
function bt_manipulate_checkout_fields ($fields) {
unset($fields['billing']['billing_email']);
return $fields;
}
add_filter('woocommerce_checkout_posted_data', 'bt_manipulate_checkout_posted_data');
function bt_manipulate_checkout_posted_data ($data) {
$data['billing_email'] = '[email protected]';
return $data;
}
本文标签: WoocommerceHow to automatically input the same email for every order
版权声明:本文标题:Woocommerce : How to automatically input the same email for every order? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741434791a2378570.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论