Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
    Posts
  • #566813

    Hi guys, i’m trying to change the price position in the woocommerce product grid. The price usually appear under the product image and i would like it to be on the product image. So i need to move it in the appropriate div.

    Here is a screenshot to help you understand what i’m trying to do.

    Screenshot

    You can see the <span class=”price”> is currently under the <div class=”inner_product_header”> and i would like to move it under the <div class=”thumbnail_container”>

    Many thanks in advance for your help.

    • This topic was modified 8 years, 10 months ago by Benoit.
    #566834

    In fact i just want to change the position of the “price”, to have the price hover the product image. I can move it (drag it) in the chrome Developer Tools but i can’t find a proper way to edit the source code to make the change.

    #566946

    Hi,

    Could you provide us with a link to the site in question so that we can take a closer look please?

    Thanks,
    Rikard

    #567240

    Hi Rikard, Thanks for your help.

    It should be same for any website with woocommerce grid. But see below the link to the website i’m currently building.

    #567243

    The <span class=”price”> is under <div class=”inner_product_header”> i would like to have it under <div class=”thumbnail_container”> so it can be visible over the product images.

    Thanks again !

    #567933

    Any idea would be very appreciated. I can’t find the source code, to change where the price is displayed.

    #567946

    Hey!

    Sorry for the late reply!

    Do you mind creating a temporary admin login and posting it here privately?

    Regards,
    Yigit

    #567953

    Here it is

    #568219

    Hey!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_price_pos(){
    ?>
    <script>
    jQuery(window).load(function(){
    var movedPrice = jQuery('span.price').html();
    jQuery('.inner_product .thumbnail_container').append('<span class="price">'+movedPrice+'</span>');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_price_pos');

    Regards,
    Yigit

    #568232

    Thanks Yigit, You are a genius !!

    But now, i have a duplicate price, one exactly at the appropriate place and the other at the original place.
    Can you help me remove the original price.

    Thanks!!!

    #568326

    Hey!

    Please add following code to Quick CSS

    .inner_product_header span.price { display: none !important; }

    Best regards,
    Yigit

    #568347

    Thanks Yigit, it works, but now i notice that the price is the same on each product and it display the price even on products without price ?

    #568417

    Hi!

    We have made some changes in the css please check the site now.

    #top .main_color .price{
        position: absolute;
        top: -220px;
    }

    I could not figure out where you added the below css but you can remove it if it is in a child theme css.

    
    .inner_product_header span.price { display: none !important; }
    

    Hope this helps.

    Best regards,
    Vinay

    #568674

    Hi Vinay, Thanks for your help. Really appreciated.

    But i have already tried this solution. The problem with this solution is that the price disappear if i use smaller products grid and it also disappear on tablet and mobile. With the other jQuery method i was able to create smaller grid without loosing the price and it was also responsive on tablet and mobile.

    #568682

    Hi Benoit!

    Please add following code to Quick CSS as well

    @media only screen and (max-width: 769px) {
    #top .main_color .price {
        top: -130px;
    }}

    Regards,
    Yigit

    #568690

    Thanks Ygit , It work for tablet but not for mobile ( see the website) and it dosent resolve the smaller grid problem.

    #568695

    The first option with the jQuery was awesome, apart from the fact that the price is not good and displayed on all the products. Is there a way to use this method with a fix for the price problem ?

    Thanks a lot for your help guys, much appreciated.

    #568719

    Hi!

    To move this price tag on top and to make it look good on any size product you will have to break it free from it’s exciting container and place it inside the thumbnail container and this can only be done using a child theme. all tho an easier alternative would be to display the price on the bottom right of the product images. That way we can move it up same distance on all products and it will show up correctly on any size product in any size screen… Please check the site now and Let us know…

    Regards,
    Vinay

    • This reply was modified 8 years, 10 months ago by Vinay.
    #568727

    Hi Vinay,

    Thanks for the explanation. I’m using a child theme, so, will it be possible to break it free from it’s exciting container and place it inside the thumbnail container as you suggest ? The other option is a great alternative but if it’s possible i would really like to have it in the top corner.

    Regards!

    #568868

    Hi!

    Ok Sure, we will help you with this customization but we need more time to work on this as it involves more work. Until then please continue to use this alternate solution to display on the bottom of all the products and please keep the admin access open till we update you next.

    Regards,
    Vinay

    #568871

    You are awesome !!! This is one of the reason I love working with enfold, the support is amazing, even when it’s a special request you are always there to help. kriesi should be proud to have a team like you guys.

    Thanks a lot !!

    Regards!

    Benoit

    #568973

    Hey!

    Thank you for your kind words Benoit! :)

    Regards,
    Yigit

    #568993

    Hi!

    Thank you for the kind words and appreciation :)

    The price position is moved using the modified version of the jQuery code Yigit provided earlier please check the site and let us know what you think.

    // Price Position
    function add_custom_price_pos(){
    ?>
    <script>
    jQuery(window).load(function(){
        jQuery('span.amount').each(function() {
            var movePrice = jQuery(this);
            movePrice.prev().append( movePrice.html() );
            jQuery(this).parents('.inner_product').find('.thumbnail_container').append('<span class="price">'+'<span class="amount">'+movePrice.html()+'</span>'+'</span>');
            console.log('Price is  :' + movePrice.html());   
        });
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_price_pos');
    

    Cheers!
    Vinay

    • This reply was modified 8 years, 10 months ago by Vinay.
    #569025

    Amazing !! Thanks guys, your help is always very appreciated. I’ll let you know when the website will be finish in order to show you what i was able to create with your help on the latest issues. ( because right now the site is at the beginning of creation)
    Keep up the great work! *****

    Regards!

    #569223

    Hey!

    Glad we were able to help you :)

    Yes we would love to see what you have done with enfold. Please feel free to showcase your site here https://kriesi.at/support/topic/enfold-showcase/

    Should you have any questions in future please get in touch with us :)

    Best regards,
    Vinay

Viewing 25 posts - 1 through 25 (of 25 total)
  • The topic ‘Change the position of a div in the woocommerce product grid’ is closed to new replies.