How to set woocommerce checkout form values to empty - wordpress

I am using Woocommerce plugin for a WordPress site. But when as user I checkout I can see form populated with last user's details. How to set form entries to blank in Woocommerce. Please help.
Fields are pre-populated with last user's detail. Is there a way to avoid this?

Not sure with your exact issue , but there might be two possible situations in your case.
You might me logged in with same user and then trying to
checkout, as woo-commerce will fetch the details of currently active
user and auto fill it during checkout.
Fields might get auto fill from your browser cache , try to checkout using another browser or
by clearing cache , if its due to cache than that's not an issue at
all, as it your browser functionality which keep the data store
temporarily for your next usage.

Related

woocommerce password reset will empty cart

Is it normal that if I reset my password and then login again to the store it will empty my cart?
These are steps I have taken:
Login to the woocommerce store
add a product to the cart
logout from the store
reset my password
login again to the store with the new password
the cart is now empty.
I believe that it is the password rest that triggers the cart to be emptied. Why does it work this way? I suppose it is a security issue.
If I don't reset my password and logout and then login again, the cart will contain the product I previously added. This is fine.
Just wondering why the password rest will empty the cart.
Just wondering why the password rest will empty the cart.
This is normal behaviour. like Ozgur said, the user session is "cleared" upon resetting the password.
Why does it work this way? I suppose it is a security issue.
It is indeed a security based behaviour. If you want to learn/understand a bit more about what is happening, you can take a look at what are Nonces.
Source # https://codex.wordpress.org/WordPress_Nonces.
To get around that behaviour and remain secure:
You could save the user cart info as a cookie/LocalStorage (JS based solution) (More # https://www.w3schools.com/jsref/prop_win_localstorage.asp) and save the product ID that are in the user cart...
You could also save it as a user metadata (PHP based solution) and serve it back to the user in that specific case.
You could for example, when the user log back in, present him a popup window and a button to add all the items to his cart once more OR simply redirect him straight away to his cart by adding all the items. You can take a look at the link bellow to add products via url.
Source # https://gist.github.com/lukecav/ab9dbdee88de686ce6b59c264cde8970

Woocommerce - Order Tracking Link

I want to include a 'check my order status' link in the thank you email. Woocommerce comes with a order tracking form, but the user has to input their order id and email. Is there a way to show the tracking page without going through the input form?
I know my accounts has a view order link, but that would only work if the user is registered.
Yes, you can show an order tracking link in your email. It is a bit convoluted way and will take some time. It is much easier to let the user input his information. This makes things a lot less complicated. But if you absolutely need the order tracking in the email, then,
Put this information somewhere other than your secured site,
Make sure you update this information regularly,
Take the ID of
this information from your database and make a GET endpoint(hoping
its a web application), such that it takes in the ID number of the
information and displays it,
This GET link needs to be embedded
into a HTML form/template which you are sending as the email
If you want the whole implementation, you need to specify the tech stack you are using and other details.
If you want to show one tracking page which page customers/users can search their order status without login, then you can use the plugin Order Tracker for WooCommerce
If you use the plugin then the user can check his/her order status without login/hassle free, and also you don't need to add any extra tracking number, user can search using their order ID and phone number.
you can use it the very easy way, like making a page template or using the [cbwct-order-tracker] shortcode, anytime anywhere, and it’s also working with ajax.
You can watch the video for the plugin documentation on how to use that plugin here is the
Video Tutorial

How to programatically unhide Drupal 7 content field

On my company's Drupal 7 site, I created a field for one of our content types through the admin UI. We decided to hide it from the user until some styling changes make it through to production. Is there a was to programmatically unhide the field via an update hook? I know get at least some of the field information through the field_info_field function, but I'm not sure how if it contains the setting needed to make the field visible to the user. Any help on this would be appreciated.
I know I can unhide it through the UI once the changes hit production, but it would be nice to have an automated way of doing this.
You can hide it programmatically from it's node template with hide() function:
https://api.drupal.org/api/drupal/includes%21common.inc/function/hide/7.x
You can do that conditionally, i.e. by checking user role first.
Now, I'm not sure will this work from update hook, and I'm not even sure why you want to use that hook?!? If users are allowed to edit that content type and you actually want to hide it from edit form then check out my answer here:
Drupal 7 - Hide certain form fields of a content edit form depending on the content data
You can use https://www.drupal.org/project/field_permissions drupal module to hide and unhide fields to users of specific role.Initially during development the field can be made visible to admin role and then later on the permission can be granted to users of other roles

PayPal Express Landing Page and SolutionType having no effect

I am using the PayPal Express NVP checkout process and my customer has a requirement for the following:
The user is initially presented with the login screen and not the billing page
The user should not be able to checkout anonymously by credit card
The documentation makes it quite clear that this is possible:
https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
Setting the following options should achieve what I require:
SOLUTIONTYPE=Mark
LANDINGPAGE=Login
This stackoverflow article describes how to achieve the second option as part of the account settings which I have also done.
I've cleared all cache and stored cookies yet it appears these properties are having no effect whatsoever. I am still taken to the billing page and the ability to checkout anonymously remains.
Am I missing something, or is there anything else I need to do to make this work?
There is also a setting in the PayPal profile to turn off the guest checkout option. Go to profile/settings, my selling tools, and then Website preferences. Toward the bottom of the page you will find a setting "PayPal Account Optional" which should be turned off and then save the change at the bottom of the page.
when 'MARK' is passed it overrides the paypal account optional setting. That said, have you tried just passing LANDINGPAGE=LOGIN ? You don't have to pass SOLUTIONTYPE=MARK.
Just had the same issue and came across this post. What solved it for me was an additional property LandingPageSpecified, which must be set to true.

how to inactivate user in wordpress

I want to inactivate a user in wordpress and block him from login. I have updated user_status is 2 in wp_users table. And it is working fine. But the following article shows that user_status has no value in wordpress.
[link]https://wordpress.org/support/topic/what-is-the-status-of-user_status
So, can you suggest how to inactivate a user block him from login
Use word press plugin Account Locker Lite which provide facilities for block user with out delete user account in word press and inactivate a user block him from logging.
The user_status field is effectively a dead record in the database. It’s been that way for some time.
You could certainly make use of it for your own purpose, but as it is a sort of deprecated or unusued element, it’s always possible it will be dropped from a future version of WordPress. Or even be put back to work.
Based on https://wordpress.org/support/topic/what-is-the-status-of-user_status

Resources