• Curious if there is a hook to inject attribute data into the listings layout? I need to show Engine size, Transmission etc… I’m using my_add_short_description to show the excerpt currently trying to get

    $transmission = array_shift( wc_get_product_terms( $product->id, ‘pa_transmission’, array( ‘fields’ => ‘names’ ) ) ); added to that function instead of the_except(). I think I’m on the wrong path because what I’m trying to load through the functions file.

    Any help would be appreciated it.

    Thank you

    https://www.ads-software.com/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • If you are getting a specific attribute you can try:

    global $product;
    $yourvar = $_product->get_attribute(‘pa_yourattribute’ );

    If you have stored the attribute as a custom meta you can try this:

    $yourvar = get_post_meta( $product_id, ‘attribute_pa_yourattribue’, true );

    If you want to retrieve all of the attributes associated with a specific post id, you can use this sql statement. I usually use this in phpmyadmin to see all of the attributes for a product before I use the first option I gave you above.

    //get all taxonomies associated with a product ID
    SELECT WTRC.object_id, WTRC.term_taxonomy_id, WTTC.term_id, WTTC.taxonomy, WTC.name
    FROM wp_term_relationships WTRC
    LEFT JOIN wp_term_taxonomy WTTC ON WTTC.term_taxonomy_id = WTRC.term_taxonomy_id
    LEFT JOIN wp_terms WTC ON WTC.term_id = WTTC.term_id
    WHERE WTRC.object_id = 12345

    Good luck with your project.

    AJ

Viewing 1 replies (of 1 total)
  • The topic ‘Particular Attributes in List View’ is closed to new replies.