Home Forums Basel support forum Add size info to shop product archive page

Add size info to shop product archive page

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #23618

    Divites
    Participant

    Hi,

    I would like to display the size of the product below the product title on the shop archive page. Now it only displays the name of the product. I have filled the size field of the product.

    How to achieve this?

    Thx for your prompt reply.

    Best regards,

    Johan

    #23629

    Artem Temos
    Keymaster

    Hello,

    There is no such option in our theme to display the size attribute on the shop page. It may require additional customization of the theme template files to achieve this.

    Regards

    #23637

    Divites
    Participant

    Hi,

    Thx for your prompt reply.
    Could you please help me with the additional customization.

    Best regards,

    Johan

    #23641

    Artem Temos
    Keymaster

    We are sorry, but additional customization of theme files are out of scope of theme support service according to Envato Support Policy https://themeforest.net/page/item_support_policy

    Regards

    #23644

    Divites
    Participant

    Hi,

    Thx again. That sounds a bit strange as other themes do support this. Please see: https://kriesi.at/support/topic/woocommerce-adding-attribute-to-shop-page-results/

    Besides that I see a lot of custom code in support threads.

    Please help. I would really appreciate it.

    Regards,

    Johan

    #23645

    Artem Temos
    Keymaster

    Hi,

    OK, if you want, we can provide you with a code snippet that shows this information so you just put it in the appropriate file.

    Regards

    #23648

    Divites
    Participant

    Hi,

    Thx! I really appreciate it. I want the size attribute between the title and the button.
    I will then put in the appropriate file myself.

    Best regards,

    Johan

    #23649

    Artem Temos
    Keymaster

    Hi,

    Add this code snippet to the functions.php file in the child theme first

    function basel_show_dimensions() {
        global $product;
        $dimensions = wc_format_dimensions($product->get_dimensions(false));
    
            if ( $product->has_dimensions() ) {
                    echo '<div class="product-meta-size">' . $dimensions . '</div>';
            }
    }

    Then, put this code to the file basel-child/woocommerce/content-product-link.php. You just need to copy the file from the parent theme and then modify it.

    <?php basel_show_dimensions(); ?>

    Regards

    #23650

    Divites
    Participant

    Hi,

    thx for your prompt solutions.
    I have added the code, but it displays above the product image. please see: http://designbadkamers.divi-test.nl/product-categorie/baden/

    I placed the code here on the 9th line:
    <?php
    global $product, $woocommerce_loop;

    $timer = basel_get_opt( ‘shop_countdown’ );
    // Sale countdown
    if ( ! empty( $woocommerce_loop[‘timer’] ) )
    $timer = true;
    ?>
    <?php basel_show_dimensions() ?>

    <?php do_action( ‘woocommerce_before_shop_loop_item’ ); ?>
    <div class=”product-element-top”>
    “>
    <?php
    /**
    * woocommerce_before_shop_loop_item_title hook
    *
    * @hooked woocommerce_show_product_loop_sale_flash – 10
    * @hooked basel_template_loop_product_thumbnail – 10
    */
    do_action( ‘woocommerce_before_shop_loop_item_title’ );
    ?>

    <?php basel_hover_image(); ?>
    <div class=”basel-buttons”>
    <?php if( class_exists(‘YITH_WCWL_Shortcode’)) basel_wishlist_btn(); ?>
    <?php basel_compare_btn(); ?>
    <?php basel_quick_view_btn( get_the_ID(), $woocommerce_loop[‘quick_view_loop’] – 1, ‘main-loop’ ); ?>
    </div>
    </div>
    <?php
    basel_swatches_list();
    ?>
    <?php
    /**
    * woocommerce_shop_loop_item_title hook
    *
    * @hooked woocommerce_template_loop_product_title – 10
    */
    do_action( ‘woocommerce_shop_loop_item_title’ );
    ?>
    <div class=”wrapp-swap”>
    <div class=”swap-elements”>
    <?php
    /**
    * woocommerce_after_shop_loop_item_title hook
    *
    * @hooked woocommerce_template_loop_rating – 5
    * @hooked woocommerce_template_loop_price – 10
    */
    do_action( ‘woocommerce_after_shop_loop_item_title’ );
    ?>
    <div class=”btn-add”>
    <?php do_action( ‘woocommerce_after_shop_loop_item’ ); ?>
    </div>
    </div>
    </div>
    <?php if ( $timer ): ?>
    <?php basel_product_sale_countdown(); ?>

    <?php endif ?>

    Should I place it somewhere else?

    Thx!

    #23652

    Artem Temos
    Keymaster

    Place it after this code

    do_action( ‘woocommerce_after_shop_loop_item_title’ );
    ?>
    #23662

    Divites
    Participant

    Thx so much. I really appreciate it.

    Best regards,

    Johan

    #23665

    Artem Temos
    Keymaster

    You are welcome!

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Add size info to shop product archive page’ is closed to new replies.