How to make Woocommerce not to save Checkout billing fields - php

I have a particular case where I need many people to login to ONE specially created user (one login name and one password for all) and purchase items through it. The problem is if Person A logins with this ONE user credentials and makes a purchase he will leave a trace in shipping/billing details, person B will then see those details when in checkout page. Woocommerce saves those details by default, how could I disable that? How can I make Woocommerce Chechout page to always have empty fields with no prepopulated data from previous purchases?
Thanks!
Mantas

you need this filter... this filter is meant to overwrite the values being displayed at checkout... below will return empty string... to empty the values being displayed.
add_filter('woocommerce_checkout_get_value','__return_empty_string',10);
But this does not mean, these values won't be seen in other places.. like "My Account" page..

Related

Wordpress checkout, modify fields content before going into db

I've add an hidden field on my checkout process plugin. I would like to programmatically change the customer phone number after he submits the order. What would be the correct hook to use, and also where I get the fields as reference, or I need to change the customers information in a different way ?
Thanks

No traces of a user's shopping website until user reopens shop?

I have a friend that found one more problem with the shopping website, her StackOverflow account (Displayed ID name is Ruth) has been used to ask a question for something else today and could not ask another one until two days later. So I have decided to ask the question for my friend.
She is creating a shopping website that allows users to create an account and open a website. If they choose to close down the shop, there is a button for it. So far on the database table, there is a disabled field for the shop, so that the user can reopen the shop again, so she's not completely deleting the shop from the table. But she wants the users not be able to find the information and items of that closed website. So basically no traces of the website is there until the shop owner opens it back up again.
How to make it so that others are not able to find any traces of the website and its items all at once?
It's simple, you add a flag in the database table for example Enabled (boolean) and depending on the condition you fetch the data accordingly.
In your php file, you can fetch the result of the shop from MySQL and if the shop enabled is false, you display a page saying that it's not reachable otherwise you display the shop.
Depends on your application's logic.
Do you have the "disabled" field on a user or shop table? I think it would be easier to implement it on a shop table, that way your shop is set to disabled more clearly.
In this case, I do not think having no traces of the shopping website is even accurate to put. Are you fetching data from a get variable to show the items of that shop? Okay, maybe the ID of that item still exists, because you need it to exist if you still have the table and all the shop items not deleted. What you can do is set up an if statement when the page receives the get variable to display that item. This statement tests whether the item's shop is disabled or not, and this you would need MySQL to help. So when it is disabled, just redirect them to a 404 page or an error page of your customization.
Now, when you do go looking for that shop's website, that should also redirect to a page saying that the shop is not existing. Although this practice is not entirely the best (in terms of security), it may very much be what you are looking for.

WooCommerce Order meta data appears twice, once with underscore

I have inherited a site built on Woo-Commerce that I'm helping out a non-profit with. It has a few problems that I've been fixing, but seeing some odd bugs when they edit the orders.
It seems like all the order billing meta data tags appear twice, once with underscore and once without, like:
_billing_first_name
billing_first_name
They both contain the value enter by the customer when they made the order, however the underscore version is what gets edited if you use the Admin dashboard to edit the billing info, and the NON underscore version appears under custom fields.
This is causing some confusion, and I have done a fair bit of searching and not figured out the why.
Thanks in advance if anybody has any hints, otherwise I'll be poking into the code.
This is completely normal (and is not a bug).
As woocommerce is a Wordpress plugin, it use the classic User data tables. But Orders are a custom post type that store they own user data.
In woocommerce as you can buy optionally without being registered, in that case the user data is only located on the Order postmeta data.
When non registered user make his first purchase (registering at the same time) the data is saved in both wp_usermeta and wp_postmeta tables.
When user register before purchasing anything, the data will be registered only in wp_usermeta table.
For all of that reasons there is 2 locations for user data:
1) billing_first_name - The user data is stored on wp_usermeta table and it's editable from the user my account pages (or on backend from users edit pages).
2) _billing_first_name (start always with an underscore) - The order customer data stored in wp_postmeta table and it's only editable through backend Order edit pages by admins and shop managers. This data is displayed on orders everywhere and on email notifications...
The underscore at the beginning is avoid this data to be displayed in custom fields Meta BOX (in Order edit pages).
So an Order can have different billing or shipping fields than in usermeta data, as a customer can have different billing/shipping data if he want to.
Woocommerce needs both of them. You should not make any change related to this, because it will be a real nightmare for you…

Use woocommerce with calculated quot from front end

I'm developing a website for a courier service, that has service quotation filling at the front end.
I did all form things working, a quotation will output variable with the cost of service in PHP.
After filling the form there will be checkout button, with that checkout button i need to save the details of the user, and that price to the woo commerce page to check-out/or fill further details. I searched throughout the google and got 1 solution to create a product with these values in front end. But its became very difficult to figuring out signing in, saving values, keep details in specific formate etc... for me as a beginner in PHP.
Can anyone help me with this?.
i just need woo commerce to make checkout with user entered details in the form.... .
EDIT & Updated :
Thanks for reply LoicTheAztec, I have gone through quick toure now
About code : I'm sending the values calculated in form to the page called buy-now using URL using javascript window.location.href=.
like http://example.com/buy-now?price=120&weight=80&location=000001
And also I'm able to fetch the value using
if (isset($wp_query->query_vars['pricef'])) in page template. (with StackOverflow help) and I'm checking user is logged in? using if(!is_user_logged_in()) and showing login form, After login also i can get the variables.
Now I need to create a transaction using this.
Saving data like a product or post and proceed for payment, I don't need to use woocommerce to do this but need some sort of idea to make it work.
Thank you.

magento onepage checkout manage fields

I want to show FAX field at every checkout. Right now in magento 1.9.1 there is a functionality that if you are existing user and you are giving order two or more times then it doesn't ask you to enter address everytime but it will auto fill it from database. But I want that FAX fields should always be visible to user and if he enters value then store it otherwise it should store NULL value.
Thanks in advance.
You can add field in checkout look field add in checkout.
In this link you will find jobtitle added in checkout you need to replace "job title" with "FAX".
Magento should have a fax functionality under the customer address object.
https://www.mymagento.com/index.php/admin/customer_address_attribute/
Either enable it and toggle it to required or duplicate the phone field and set it to be fax. You may need to tweak it as desired in the frontend template used: ( vanilla: app\design\frontend\base\default\template\checkout\onepage\shipping.phtml )
If you're looking to force confirmation on an existing customer address entry (fax) there may be a more extensive customization you need to do.
I would explore your onepagecheckout controller that is currently used ( vanilla: app\code\core\Mage\Checkout\controllers\OnepageController.php ) to see if any other customizations/validation is needed.

Categories