- This topic has 6 replies, 3 voices, and was last updated 3 months, 4 weeks ago by
David.
-
AuthorPosts
-
October 28, 2020 at 5:48 pm #1508660
nik9
Hello,
We just noticed that the “Add to cart” button does not show up after hovering over a product on product archive. (See link)
We did not change some thing in CSS or so,,, thanks. 🙂October 28, 2020 at 6:03 pm #1508673Elvin
StaffCustomer SupportHi,
I’m not sure I understand what you mean.
I don’t see any “Add to cart” button even when I’m hovering on the products.
Did you mean the price that fades up when hovered? Ex: “CHF 4.70”
A wise man once said:
"Have you cleared your cache?"October 29, 2020 at 12:55 am #1508865nik9
Hi Elvin, Yes that is exactly the problem. The price that fades up when hovering is missing…. 🙁
October 29, 2020 at 2:28 am #1508927nik9
Update: I was able to solve this. Was a CSS issue but I do not understand why this was a problem now haha.. That was working for weeks.. 🙂
But I have now a following question..
I know I can use this code below to change the Add to cart text.
add_filter( 'woocommerce_product_add_to_cart_text', function() { return 'Hinzufügen'; } );
Question: Is there a way, that we can change the label text ONLY from products that are sold out?
October 29, 2020 at 3:38 am #1509007David
StaffCustomer SupportHi there,
Try this:
add_filter( 'woocommerce_product_add_to_cart_text', 'change_sold_out_product_button_text_label', 10, 2 ); add_filter( 'woocommerce_product_single_add_to_cart_text', 'change_sold_out_product_button_text_label', 10, 2 ); function change_sold_out_product_button_text_label( $button_text, $product ) { $stock = array(); // Only for variable products on single product pages if ( $product->is_type('variable') ) { foreach ($product->get_available_variations() as $key => $value){ $stock[] = isset( $value['is_in_stock'] ) ? $value['is_in_stock'] : true; } if( empty( array_filter( $stock ) ) ){ $button_text = __( "Hinzufügen", "woocommerce" ); } } // For all other cases (not a variable product on single product pages) elseif ( ! $product->is_type('variable') && !$product->is_in_stock() ) { $button_text = __( "Hinzufügen", "woocommerce" ); } return $button_text; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 29, 2020 at 4:01 am #1509044nik9
great! Thanks 🙂
October 29, 2020 at 4:09 am #1509059David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.