Archived topic
Problems with Woo attributes-hook
33 replies · Started by Paul on December 8, 2021
Try this CSS:
/* Set fixed space between Image and content *./
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link {
margin-bottom: 5px;
}
/* Force content to fill height of product grid */
.woo-content-wrap {
flex: 1;
display: flex;
flex-direction: column;
}
/* Center button */
.woocommerce ul.products li.product .woo-content-wrap .button {
margin: unset;
}
/* Auto space above to price to keep price and buttons aligned */
.woocommerce ul.products li.product .price {
margin-top: auto;
}
Wow, this is perfect. Thank you so much, David.
I've been thinking about this already in a while and I think now it's the time to ask, without wanting to be intrusive: Is there a postal address that I can send you some Austrian wine and delicious pumpkin seed oil for salads and soups for you to enjoy? I mean that, because your support is exceptional. I'm not a professional developer, but we've been working a whole lot on this site and since a new book is going to be published tomorrow, it should go live to this date. I am very happy with having chosen GeneratePress and with my new site. The only thing I was worried about was, if I will be able to fix the last errors, especially this one. Now I'm positive that the last tweaks and changes will work out smoothly and your help has been gold.
Hey, I celebrated too quickly.
There is still the problem with Cross-Sells on the cart page.
Is there a way to fix that? (I had to delete the cross-sells in the meanwhile to avoid the faulty display, so it's not replicable at the moment)
Oh that is weird. Presumably the columns are not behaving themselves. Can you re-enable the cross sells so i can see what happened here?
Regarding your super kind offer - not sure what the protocol is there. If you want to send some info via Account form to discuss :)
Okay, I will get in touch! :-)
I just reenabled the cross sells. You have to add the book "Leuhtfeuer im Kupfer der Dämmerung" (red book, second row in center) to the cart, as this product ist the only one with cross-sells applied in WooCommerce.
Hmmm... just to confirm my suspicions can you temporarily remove / disable this snippet:
https://generatepress.com/forums/topic/problems-with-woo-attributes-hook/#post-2043820
I disabled it. However, there's still something wrong in the cart section.
Hmmm... so its not that function thats a problem. You can re-enable that.
What else do we have ? Theres the function thats adding the woo-content-wrap - what if you disable that ?
Sorry its trial an error - theres basically some broken HTML being added to those ( and only those ) products.
Yes, now we got the culprit. When I deactivate this code, then the cross-sells on the cart page are fine:
/**
* Woo Commerce Shop Wrapper
*/
add_action('woocommerce_shop_loop_item_title', 'woo_shop_loop_item_open_wrapper',9);
add_action('woocommerce_after_shop_loop_item', 'woo_shop_loop_item_close_wrapper',100);
function woo_shop_loop_item_open_wrapper() {
echo '<div class="woo-content-wrap">';
}
function woo_shop_loop_item_close_wrapper() {
echo '</div>';
}
However what happens then is that the Add-to-cart-button is left-aligned and not centered.
I left the code activated for now because the site is live, but just tell me if I should deactivate it.
This function:
function woo_shop_loop_item_close_wrapper() {
echo '</div>';
}
Can you change it to:
function woo_shop_loop_item_close_wrapper() {
echo '</div><!-- close woo wrapper -->';
}
It won't fix the issue but it'll provide a comment in the HTML that i can look for. I get the impression that function isn't being hooked in on the cross sells.
Thanks for checking that. I replaced the function!
Well how very bizarre - its not doing anything lol.
I am kinda thinking - do we need these functions anymore? As we no longer require the wrapper to place the content to the side.
What happens if you remove them altogether?
Yeah, I was wondering about this too. Yeah, what happens is, that the add-to-cart-button is left-aligned and not center-aligned anymore. Can this be tackled with CSS? I'll leave tha functions out for now.
David, I solved the problem!
There was the entry "margin: -18px" in the buttom customisation as an old remains. Everything's fine now! :-) Thank you so much for your help and I'll write you through the contact form. :-)
Awesome - glad to hear that!!