pre-defined data for checkout (original) (raw)
- I want to remove billing and shipping field information on checkout page. User don’t need to fill that and use data from their profile himself. (their profile provide billing and shipping information).
So i just removed the field from template, i hope i can get hook before checkout process so i can defined data needed.
But i can’t find it, and currently the checkout always fail i am sure because required field are deleted.
how to add the data needed before proccessing checkout?
Viewing 6 replies - 1 through 6 (of 6 total)
- Probably best to leave the template alone. Edits will be overwritten by updates. Use a filter instead.
See:
https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
So for example, if you don’t want a phone number, your filter might use:
unset($fields['billing']['billing_phone']); For a pain-free solution, try Booster (free version):
https://wordpress.org/plugins/woocommerce-jetpack/
Select the “Checkout Core Fields module” in the “Cart and Checkout” section, and select disable for the unwanted fields.
Or try this:
https://wordpress.org/plugins/woo-checkout-field-editor-pro/
oh thankyou @lorro,
yes i see it before, we can unset it, but will it makes billing phone in order detail are empty?
i don’t want empty, kinds like
1. unset-ing fields (eg billing phone)
2. when proccess checkout, i fill variable needed (eg billing phone i will take from user profile)
3. save as regular order
can it?
- This reply was modified 9 years, 2 months ago by
Yoga Sukma.
There is some code here to set the default values from the logged-in $user object:
http://stackoverflow.com/questions/39922747/woocommerce-set-billing-field-value
I would not hide the fields. I would present the existing values to the customer, so he can change them if they are wrong.
At my case, user are registered user and not allowed to change their shipping address. They need to contact the admin to changes it.
anyway after some digging into woo code, i found the way how to do it, using action woocommerce_checkout_process.
- This reply was modified 9 years, 2 months ago by
Yoga Sukma.
Ok, it’s works but found little glitch.
it seems shipping information used billing information even tough i set my shipping information.
still digging into it
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘pre-defined data for checkout’ is closed to new replies.