Writing custom code to create product detail page with wordpress database.
I have displayed product title, desc, price, stock, etc and got stuck up with product attr
I took a little bit of a different approach, I created a stored procedure in my database that will return all terms associated with a woocommerce product. I decided to go this route because i can call the procedure from my wordpress site and the desktop app I am creating without having to write the function in two different languages.
Though I'd post it here for others to use.
CREATE DEFINER=`database_name_here`@`%` PROCEDURE `get_product_attributes`(IN ProductName TEXT)
BEGIN
SELECT DISTINCT
p.post_title AS 'Product Name',
t.name AS 'Term Name',
tt.taxonomy AS 'Term Type',
tt.description AS 'Term Description'
FROM
wp_posts AS p
INNER JOIN
wp_term_relationships AS tr ON p.id = tr.object_id
INNER JOIN
wp_term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN
wp_terms AS t ON t.term_id = tt.term_id
WHERE
p.post_title= ProductName
AND
p.post_type = 'product';
END