Skip to content

Instantly share code, notes, and snippets.

View hrehman200's full-sized avatar
🏠
Always working from home

Haris ur Rehman hrehman200

🏠
Always working from home
  • Softcode
  • Kohat, KPK, Pakistan
View GitHub Profile
@lukecav
lukecav / Query
Last active January 7, 2023 15:29
Get all Products from WooCommerce (product title, sales price, regular price, stock, weight, sku and product categories) in the database using a MySQL query
SELECT
wp_posts.post_title AS Product,
wp_postmeta1.meta_value AS SKU,
wp_postmeta2.meta_value AS Price,
wp_postmeta3.meta_value AS Sales Price,
wp_postmeta4.meta_value AS Stock,
wp_postmeta5.meta_value AS Weight,
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories
FROM wp_posts
LEFT JOIN wp_postmeta wp_postmeta1