- This topic has 27 replies, 2 voices, and was last updated 5 years ago by
Leo.
-
AuthorPosts
-
April 6, 2018 at 9:55 pm #543459
Vincenzo Quarta
Hi,
can I obtain a Woocommerce product list layout like this https://gyazo.com/79d205fb19e08e43aae85b06767250e3 with price and buy button on right?
Thanks.April 7, 2018 at 2:30 am #543580Vincenzo Quarta
I’m editing post for screenshot link.
Thank you.April 7, 2018 at 10:03 pm #544201Tom
Lead DeveloperLead DeveloperIt should be possible.
First, I would set the image alignment to the left in Customize > Layout > WooCommerce.
Then if you can link me to your site, I may be able to do the rest with CSS.
Let me know ๐
April 8, 2018 at 12:39 am #544243Vincenzo Quarta
Thank you Tom,
can I send you the link by email? ๐April 8, 2018 at 9:35 am #544594Tom
Lead DeveloperLead DeveloperIf you edit your original post in this topic, you’ll see a URL field which only admins can see ๐
April 8, 2018 at 10:50 am #544635Vincenzo Quarta
Done!
April 8, 2018 at 9:21 pm #544879Tom
Lead DeveloperLead DeveloperAlright, the HTML needs tweaking a bit.
Let’s add this function:
add_action( 'after_setup_theme', 'tu_move_wc_elements' ); function tu_move_wc_elements() { remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_price', 30 ); add_action( 'woocommerce_after_shop_loop_item', 'tu_before_wc_items', 7 ); add_action( 'woocommerce_after_shop_loop_item', 'tu_after_wc_items', 40 ); } function tu_before_wc_items() { echo '<div class="wc-items-container">'; } function tu_after_wc_items() { echo '</div>'; }Once we do that, the CSS should be a lot easier.
Let me know ๐
April 9, 2018 at 12:03 am #544959Vincenzo Quarta
Done, I added the function!
April 9, 2018 at 11:48 am #545612Vincenzo Quarta
Sorry Tom,
I added the function but it only put the price below the button.
Do you need to work more on CSS?
Thank you. ๐April 9, 2018 at 8:51 pm #545934Tom
Lead DeveloperLead DeveloperYes, sorry! More complicated than I had hoped.
I had it working, but wasn’t super happy with the code to achieve it.
I just adjusted the PHP above – can you replace the code you added with it?: https://generatepress.com/forums/topic/woocommerce-product-list-layout/#post-544879
That should give it a container which we can target better.
Let me know ๐
April 10, 2018 at 12:00 am #546003Vincenzo Quarta
Hi Tom,
code replaced!If you can be useful this is a site that uses the layout that I would like (https://courseroot.com) but does not use WooCommerce.
I also saw a theme that allows me to have that layout with Woocommerce but I love Generatepress! ๐
Thank youApril 10, 2018 at 8:51 am #546440Tom
Lead DeveloperLead DeveloperGive this a shot:
@media (min-width: 769px) { .archive li.product { display: flex; } .archive .woocommerce-LoopProduct-link.woocommerce-loop-product__link { flex-grow: 1; } .archive .wc-items-container { min-width: 200px; text-align: center; } }Depending on the browsers you need to support, you might want to run that code through this tool: https://autoprefixer.github.io/
April 11, 2018 at 6:30 am #547242Vincenzo Quarta
Thank you Tom, code works fine!
Can I align title and short description to top and increase price font size?
Thank youApril 11, 2018 at 10:03 am #547564Tom
Lead DeveloperLead DeveloperThe CSS seems to be broken right now.
display: flexis missing in the CSS I provided.April 12, 2018 at 8:18 am #548497Vincenzo Quarta
Hi Tom,
I restoreddisplay flexand I added some customization.
But sometimes in pagination the container is smaller then other page.
I edit original post with url.Let me know ๐
-
AuthorPosts
- The topic ‘WooCommerce product list layout’ is closed to new replies.