• Resolved alexiirj

    (@alexiirj)


    I am starting to learn about hooks and was wondering how I can make shortcode beside WC given shortcode, that returns a list of products (say a t-shirt with attributes size, color, style) of a t-shirt category only. And the format I am looking for is not default woocommerce [products] style. i want to be plain text like following:
    XL, red, workout t-shirt
    L, yellow, party t-shirt
    XL, green, home t-shirt
    XL, black, pattern t-shirt
    I don’t want it to have pictures or thumbnail or anything I just need to know how to access these bit of info individually and concatinate them together to make the title, rather than saying $product –> $title I want to say

    attribute <slug1 > + attribute <slug 2> + attribute <slug 2> + category (tshirt)
    attribute <slug1 > + attribute <slug 2> + attribute <slug 2> + category (tshirt)
    attribute <slug1 > + attribute <slug 2> + attribute <slug 2> + category (tshirt)
    attribute <slug1 > + attribute <slug 2> + attribute <slug 2> + category (tshirt)
    attribute <slug1 > + attribute <slug 2> + attribute <slug 2> + category (tshirt)

    All I don’t know is how to loop through all those items in that particular category.

    All helps are appreciated in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/
    Thread Starter alexiirj

    (@alexiirj)

    Thank you I did a bit closer by learning that there are not really WP function that can help me out here so I am running my own queries now as follow: Please advice if this is a good practice. I will also check the links you shared. Thanks

    $sql = "SELECT attribute_name FROM wp_woocommerce_attribute_taxonomies";
    $result = $conn->query($sql);
    
    if ($result->num_rows > 0) {
        // output data of each row
        while($row = $result->fetch_assoc()) {
            echo $row['attribute_name'] . "<br>";
        }
    } else {
        echo "0 results";
    }
    $conn->close();

    but now my problem is I am getting a list of attribute names (title). How can I see the values inside it?

    • This reply was modified 4 years, 7 months ago by alexiirj.
    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    Since this is a few weeks old, and about customization, I am going to mark as resolved. A lot of people have found help in the Advanced WooCommerce group with things like this, so I would recommend checking there, or we highly recommend contacting one of the services on our Customizations page (https://woocommerce.com/customizations/)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display a list of WC product as plain text with all attributes?’ is closed to new replies.