"is_visible" flag location for Woocommerce products attributes - mysql

This matter is driving me crazy as after wasting days going through my DB I've still been unable to find out an answer to the following question:
Where is the flag "is_visible" stored on the mysql DB for the attributes of Woocommerce products?
I checked all the tables 1000 times but I can't understand where and how the flag option "attribute visible on the product page" is stored on the Wordpress DB.
Thanks!
Enrico

the data is sotered in the postmeta table. However it is not quite straight forward to handle it. If you pick a product and do a search for the product ID as post_id you will see a record with the meta_key _product_attributes. In the meta value you will find a serialised array of the attributes including is_visible.
Just be careful because if you simply edit it in phpmyadmin you can mess stuff up badly. If you don't know what a serialised array is google it.

In case someone is searching for this in the year 2022 or later: In the meantime woocommerce isn't storing this value in the post_meta table. Instead there is a taxonomy called "product_visibility" with different states (exclude-from-catalog, exclude-from-search). In the "term_relationships" table is stored which of these values is associated with a product.

Related

Cache, Database, Over 400k Listing

In my MySQL database I have a table of products which contains almost 625k rows. The table has 162 columns.
Now there is a search box on my home page where you can search for anything and, if your search term is matched from any of my product titles, it give you a list of 15 products. This is similar to Amazon and other e-commerce websites.
What I did so far was to create a JSON file with all the product ID's and title names. When user inputs a minimum of 3 chars into the search field, an AJAX request is made and gets the list. But my issue is that the JSON file is almost 12MB in size, and the ajax calls it whenever user write's a char or removes a char. It was working fine until I was on local Machine and now as soon as I made it live it doesn't work for users, having lower then 5 MBPS internet connection. So I am looking for some advice, how do I create it fast as Amazon. I mean the search with auto suggestion from 625K products.
I am really sorry, but there is nothing more to give as an advice here then "go do some reading on database design and schema normalization".
If you have 162 columns in a table you will never be able to do an efficient search. The database (especially MySQL) will not hold the table in memory and indexes will not help either. Yes, you can throw it all into an ElasticSearch instance and it will fix some of your problems. But, honestly, this solution does not clean up the mess you have.
You should have a table with relevant information (titles, names, etc.) in one column (or also a numeric column for prices, etc). This metadata should reference the main table, the column should be fulltext-indexed. This way you ask for matches, filter results and JOIN relevant lines from the main table. This will work quickly with very little resources used.

Where does WooCommerce store settings in database

I have looked in the database tables, especially all the ones prefixed by wp_woocommerce as well as the wp_options table.
I can't seem to find where the configuration settings are storeed.
Orders are setup as Posts (custom post_type). So the ID assigned to each order varies on the wp_posts table's AutoIncrement value of 'ID'.
You can modify its value if you desire.
This is stored in the
wp-options
table beginning with woocommerce_default_country
In the options table, you have something like woocommerce_{ the gateway id }_settings. The data is tore in an array of sort.
You did not answer the question when you found the answer. I had similar challenge. I figured it out.

How to synchronize product stock data between different databases in MySQL?

I´m working on a joomla website (Virtuemart 2.0.6 webshop) and the plan is to make 2 or maybe even 3 seperate webshops with different domain names and databases but the owner uses the same warehouse for all the shops.
So I´m searching to find a way to syncronize the product stock in multiple Virtuemart shops.
Basically I´m looking for way to only share one specific table field between the shops.
Specifically in Virtuemart 2.xx the product stock data is stored in the table:
"jos_virtuemart_products"
field name: "product_in_stock"
I have looked everywhere for the answer to this one, but I haven´t found anything I could use to solve this problem.
You are going to have to code a custom plugin to do this if you want to have different product names, descriptions, and prices. In any case, it is going to take a custom plugin to achieve your synchronization.
Probably the best way to do it is write a plugin that updates the other sites when an order is completed.

MySQL exporting WordPress posts with related meta data

I'm using the WP-Property plugin for an estate agents site. They want to use RightMove to display their properties as well, so I'm looking for a way to export the post type 'property' with all its related meta data.
Most of the data for a property is in the posts table, but things like the number of bedrooms, price etc are in the post meta table.
I'm not much of a back end coder, so I think I need an SQL query that will join the two tables together?
I have to convert it to a BLM file for RightMove, but I'm taking it one stage at a time, so getting the data I need out is what I need to do.
Is anyone able to point me in the right direction?
Thanks
Yes you need to write a join where the post_id of postmeta table is equal to the id of posts table

WordPressMU - get blog list, alphabetically sorted by blogname

In WordPress MU, I've tried writing my own query for this but can't seem to get all of the joins I really need. The result set I'm looking for would be something like:
blog_id
blog name
blog path
owner first name
owner last name
and return it all alphabetically, by blog name. The trouble I'm having is that the first and last name of the blog owner are in wp_usermeta, the blog id and path are in wp_blogs, and the blog name is in wp_[blog id here]_options, with wp_usermeta requiring the user ID from wp_users.
Is it possible to join all of this in one query?
There is not a way to combine all of the information into one result set because of the way WPMU handles the database table names.
The best solution I have come up with is some PHP logic that gets the blogs from the wp_blogs table, uses the IDs there to gather information from the wp_X_options tables, and then builds up the information I need. It's the same reason there is no good way to get a list of all the posts across all of the blogs with just a query. You need backend logic to build the query based on the blogs in wp_blogs.