- This topic has 5 replies, 2 voices, and was last updated 3 years, 6 months ago by
David.
-
AuthorPosts
-
April 8, 2022 at 5:35 am #2182004
pro123
Hi Team,
I have added below CSS code to the site and php code to the hook element (before_woocommerce_single_product_summary)
This will make the Woocommerce short description and add to cart module sticky.Just wondering if it would be possible to stop being sticky when I reach the long description. Currently the sticky module goes over the long description when scrolling.
I can adjust this width: 50%; /* match width of gallery stack */ but that would make related.products and upsells.products too small.
In the private section the webshop details
PHP:
<?php if ( has_post_thumbnail( $product->id ) ) {
$attachment_ids[0] = get_post_thumbnail_id( $product->id );
$attachment = wp_get_attachment_image_src($attachment_ids[0], ‘full’ ); ?>
“/>
<?php }global $product;
$product_image_ids = $product->get_gallery_image_ids();foreach( $product_image_ids as $product_image_id ) {
$image_url = wp_get_attachment_url( $product_image_id );
echo ‘‘;
}?>CSS:
@media (min-width: 768px) {
.woocommerce-product-gallery {
display: none;
}
.woo-gallery-stack {
width: 60%; /* adjust % to match container layout */
float: left;
padding: 10px;
}
.woocommerce div.product div.summary {
position: -webkit-sticky;
position: sticky;
top: 120px;
/* Adjust vertical position of sticky summary */
}
.single-product div.product .woocommerce-tabs,
.single-product div.product .related.products,
.single-product div.product .upsells.products {
width: 100%; /* match width of gallery stack */
display: inlineblock;
}
}Thanks in advance
Regards,
LuukApril 8, 2022 at 6:07 am #2182023David
StaffCustomer SupportHi there,
its trickier to do as the Tabs occupy the same parent container as the summary, which is a problem. And would require some development. Why not mirror what the Niche Site does ? See here:
https://gpsites.co/niche/product/ninja-silhouette-2/
If you follow ALL the steps here it will provide the same effect.
https://generatepress.com/forums/search/niche+woo-gallery-stack/#post-2182013
April 8, 2022 at 7:36 am #2182113pro123
Hi David,
Thanks you very much. That what exactly what I was looking for.
Last question, how can I make the WooCommerce single product page full width with some margin left and right.Thanks in advance
April 8, 2022 at 7:43 am #2182121David
StaffCustomer SupportSimplest option to make it 100% and keep the padding use this CSS:
.single-product .container { width: 100%; max-width: 100%; }
April 8, 2022 at 7:47 am #2182129pro123
Thanks you very much!
Resolved
April 8, 2022 at 7:55 am #2182297David
StaffCustomer SupportGlad to be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.