Support » Plugin: WooCommerce » Display attributes/terms names in woocommerce grid

  • Resolved inextable

    (@inextable)


    I’m using this shortcode to display a products grid in a custom page in my site:
    [product_category category=”number” limit=”number” columns=”number” attribute=”text” terms=”text” orderby=”” order=””]
    This shortocde displays a grid with products of a specific category, attributes and terms.
    Buy I would like to actually display those attributes and terms NAMES inside the grid, below the title for instance.
    Is it possible?
    can anyone help me with a code snippet? Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Niels Lange

    (@nielslange)

    Hello @inextable,

    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. WooCommerce FB group: https://www.facebook.com/groups/advanced.woocommerce/

    can you please answer this thread? its 2 weeks already
    https://wordpress.org/support/topic/multi-currency-indexing/

    Plugin Support Niels Lange

    (@nielslange)

    @saveatrain: Please do not cross-post threads that are not related to this one.

    Hi:
    Thanks for your answer. I finally found a solution. I’ll post it here just in case someone has the same need. Apologizes if my english is not very right.

    I thought I needed a snippet which called the shortcode variable but I really didn’t. Adding a snippet to woocommerce loop (after shop loop actually) is enough.

    So this works:

    add_action( 'woocommerce_after_shop_loop_item', 'show_tags', 20 );
    function show_tags() {
    global $product;
    // get the product_tags of the current product
    $current_tags = get_the_terms( get_the_ID(), 'product_tag' );
    // only start if we have some tags
    if ( $current_tags && ! is_wp_error( $current_tags ) ) { 
    //create a list to hold our tags
    echo '<ul class="product_tags">';
    // for each tag we create a list item
    foreach ( $current_tags as $tag ) {
    $tag_title = $tag->name; // tag name
    $tag_link = get_term_link( $tag ); // tag archive link
    echo '<li>'.$tag_title.'</li>';
    }
    echo '<li>custom content</li>';
    echo '<img src="img-url" alt="" />';
    echo '</ul>';
    }
    }

    So threat can be closed. Thanks anyway.

    Plugin Support m155y5

    (@m155y5)

    Automattic Happiness Engineer

    Hi @inextable

    Thanks for the update! I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.