[Support request] Add variable size on product page

Home Forums Support [Support request] Add variable size on product page

Home Forums Support Add variable size on product page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1434338
    Selina

    Hello, I would like to add the sizes to the shoes (the smallest and the largest) so that the smallest and largest size of each product can be displayed without having to click inside it, outside the product sheet. I don’t know if I have explained myself correctly.

    Some examples:
    https://www.pisamonas.es/calzado-nino/zapatito-ingles
    – webnenes.com/etiqueta-productos/nino/

    Thanks!

    #1434484
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    I’m not sure I 100% understand – can you explain a bit further maybe? Screenshots of the specific areas we should be looking at would be great.

    Thanks!

    #1434506
    Selina

    Hi, I attach this screenshot: https://ibb.co/8M3rwYx.

    For example, in the shoe on the left, it is available in stock from size 26 to 41: https://ibb.co/C7tDRkZ.
    So what I want is that without having to go into the product, I can see the smallest and largest size in each product. On my website, for example, like this: https://ibb.co/R9zhzRk.

    I hope I have explained it better now. 🙂

    Thanks!

    #1434590
    Elvin
    Staff
    Customer Support

    Hi Selina,

    You can try this PHP code.

    add_action( 'woocommerce_after_shop_loop_item_title', 'display_size_attribute', 5 );
    function display_size_attribute() {
    global $product;
    
    if ( $product->is_type('variable') ) {
    $taxonomy = 'size';
    echo '<span>' . $product->get_attribute($taxonomy) . '</span>';
    }
    }

    Just change the $taxonomy = ‘size’; value to the slug of your size attribute.
    ex: $taxonomy = ‘avail_size‘;

    Here’s How to add PHP.

    Let us know if it works for you.

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