0
votes

I couldn't able to get attribute values from woocommerce taxonomy. I have tried

select meta_value from wp_postmeta where meta_key = '_product_attributes' and post_id = '55';

It gives an array

a:1:{s:13:\"pa_size-value\";a:6:{s:4:\"name\";s:13:\"pa_size-value\";s:5:\"value\";s:0:\"\";s:8:\"position\";s:1:\"0\";s:10:\"is_visible\";i:1;s:12:\"is_variation\";i:1;s:11:\"is_taxonomy\";i:1;}}

With these array values having attribute value as null, i dono how to proceed. I creating a custom code, not with woocommerce functions.

Could you mention how to walk around with woocommerce taxonomy? and process flow to display attribute values?

2
it is better to edit first question then ask another.Michal S

2 Answers

2
votes

You need to connect data from 3 tables:
_term_taxonomy (name of attribute)
_terms (value of attribute)
_term_relationships (link between object and attribute)

0
votes

For a variable product(having price for each attribute), to get attribute value

_term_taxonomy (name of attribute)

_terms (value of attribute)

_term_relationships (link between object and attribute)

to get price for each attribute,

_options (option_value where option_name= _transient_wc_product_children_ids_productid)

_postmeta (price using optoin_value)

here mention your productid in _transient_wc_product_children_ids_productid

I hope it helps for those who create app dependant wordpress site.