I want to sum up the number of items purchased from several orders. I have this query, however it shows me each order on a separate row. I want have it all added up in one row. This is woocommerce database. Example output: and this is how it should be: Answer You want the aggregation string over all those items,
Tag: wordpress
Extend WooCommerce product search to custom taxonomies and custom fields
I am creating advance woocommerce search and I want to add sku and product_tag and product_category in search query. Below I am using Enable custom taxonomies in WooCommerce product search answer code,…
Is it possible to change a WordPress/woocommerce title that is written with uppercase to appear capitalized?
I am currently working on a project that is based on WordPress and as an e-commerce platform, it uses WooCommerce. I made a product migration from an old site that has the product titles written in uppercase. Currently I have this html code for the titles inside a product: So I want the product title to appear like “Product Title”.
SQL SELECT query to get stock qty does not return value in function ( but does from phpMyAdmin)
I am running this code in a function in Wordpress/Woocommerce to update stock values to the wp_stock_log table when I manually edit stock levels. I am attempting to get the most recent ‘qty’ value for the product and then set it as var $old_qty. I then want to insert it into the table in a new row as ‘old_qty’ so
insert into tables from another tables
Well, I trying insert into tables to another but I get this error; WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”lcl_user_agent’ (user_agent, hitcount, click_timestap) SELECT visite_useragent,’ at line 1] This is my code; I want insert into lcl_user_agent the
Update field with a shorter string
I need to modify the LENGTH of text in field in db mysql. I’ve attribute_name that I need to have with max LENGTH 28 characters. WordPress and woocommerce limit this field to 28 characters. Right now my website is down because some taxonomies are too long. There is a way to “cut” all attribute_name <= 28? All my attribute_name should
How to Count Times an ID Appears in a Column in a Different Table
Apologies in advance: I’m sure this is relatively easy and has been asked ad nauseam, but I just can’t quite come up with the proper search. Basically, I’m trying to take a list of IDs queryed from …
MySql Query to get certain number of values from limit and order by rand()
In below SQL query I need 25 rows containing product = ‘y’ and 25 rows having product = ‘n’. Product is a column having Y/N value only. In limit of random 50 rows I need 25 rows from each values. Kindly assist. I have tried Union but it didn’t work. Answer Simply use UNION for each product type:
How to JOIN postmeta table and get the posts before the date of custom field using SQL
I’d like to combine wp_posts table and wp_postmeta table and get the posts before the date of custom field. Code with only wp_posts table is below and it works fine I want to add “postmeta table” to “post table” and get only posts before the date of custom field if it is “WP_Query”, meta query would be below I tried
Filter orders by product post type in WooCommerce admin orders list page
I am new to WooCommerce, And I want to customize admin order list page. So basically I created new product type. Now I also made restriction that customer can purchase my custom product type’s product …