Woocommerce Product Tags

Hello. Anyone know the proper syntax to pull a list of woocommerce product_tag IDs in a similar fashion as this but as an “else if”

if ( is_archive() ) {
$ids = array();
$cat = get_query_var(‘product_cat’);
$args = array( ‘post_type’ => ‘product’, ‘product_cat’ => $cat );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product;

            $ids[] = $loop->post->ID;

Thanks a bunch!

Tried this as my else if, but to no avail:

   else if ( is_product_tag() ) {
        $ids = array();
        $tag = get_terms('product_tag');
        $args = array( 'post_type' => 'product', 'product_tag' => $tag );
        $loop = new WP_Query( $args );
        while ( $loop->have_posts() ) : $loop->the_post(); global $product;

            $ids[] = $loop->post->ID;

Hey @xlightwaverx,

I’m sorry but we do not offer custom coding support. Please try the Peer to Peer forum to check if someone has an experience with what you’re after.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.