Created
December 14, 2017 13:11
-
-
Save pablo-sg-pacheco/41e614a4da27f051bd953ca18662eba6 to your computer and use it in GitHub Desktop.
Get WooCommerce product type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.ID, p.post_title, t.name AS product_type | |
FROM wp_posts AS p | |
JOIN wp_term_relationships AS tr ON tr.object_id = p.id | |
JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id=tt.term_taxonomy_id | |
JOIN wp_terms AS t ON t.term_id = tt.term_id | |
WHERE p.id = 111 AND tt.taxonomy = 'product_type' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment