Home / Forums / WoodMart support forum / Add to Cart Button Visibility Problem in Grid View (Product Archives)
Home › Forums › WoodMart support forum › Add to Cart Button Visibility Problem in Grid View (Product Archives)
Add to Cart Button Visibility Problem in Grid View (Product Archives)
- This topic has 5 replies, 2 voices, and was last updated 1 year, 4 months ago by
Luke Nielsen.
-
AuthorPosts
-
March 5, 2025 at 4:39 pm #643099
uysalmehmet.092ParticipantHello,
I selected the “Standard Button” option under WoodMart Theme Settings -> Product Archives -> Product Styles. This option displays the button at the bottom.
In Grid View, the Add to Cart button appears when I initially load the page, but it disappears after a page refresh. For a period of time, the button is not visible in that product category, and then it reappears later. In short, the button is intermittently showing and hiding. How can I resolve this issue? You can test it on any product archive section of my website.
Best regards,
MehmetMarch 5, 2025 at 6:52 pm #643165
Luke NielsenMemberHello,
It looks like you have such a custom CSS code – https://prnt.sc/T-_YBmbX_vSk , so remove it, clear the cache and let me know the result.
Kind Regards
March 7, 2025 at 10:55 am #643755
uysalmehmet.092ParticipantHello,
It took me a long time to design the site, and I forgot that I had written this code. I apologize for bothering you with a simple issue. It worked. Thank you.
However, I need help with a different aspect of this button. Using the following code, I changed the button text from “Add to Cart” to “View Product.” Additionally, I disabled the add-to-cart functionality for out-of-stock and variable products, redirecting them directly to the single product page.
My issue is as follows:
For products where the button says “View Product,” hovering over the button still shows the cart icon. I want it to display the “View” (eye) icon, just like it does for out-of-stock products. If that’s not possible, I would prefer it to show nothing at all—just not the cart icon.
How can I achieve this? Thank you in advance for your help.
function woodmart_custom_add_to_cart_text( $text, $product ) {
if ( ! ( is_shop() || is_product_taxonomy() ) ) {
return $text;
}
$translations = get_translation_texts();
if ( $product->is_type( ‘simple’ ) && $product->is_in_stock() ) {
$text = $translations[40];
} else {
$text = $translations[41];
}
return $text;
}
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woodmart_custom_add_to_cart_text’, 10, 2 );function woodmart_custom_add_to_cart_args( $args, $product ) {
if ( ! ( $product->is_type( ‘simple’ ) && $product->is_in_stock() ) ) {
if ( isset( $args[‘class’] ) ) {
$args[‘class’] = str_replace( ‘ajax_add_to_cart’, ”, $args[‘class’] );
}
$args[‘url’] = get_permalink( $product->get_id() );
}
return $args;
}
add_filter( ‘woocommerce_loop_add_to_cart_args’, ‘woodmart_custom_add_to_cart_args’, 10, 2 );Looking forward to your guidance.
Best regards,
MehmetMarch 7, 2025 at 12:32 pm #643789
Luke NielsenMemberHello,
Try to use the code below to show the view icon for the variable products:
.wd-product.product-type-variable .wd-add-btn-replace .add-to-cart-loop:before { content: "\f11a"; }Kind Regards
March 7, 2025 at 12:56 pm #643801
uysalmehmet.092ParticipantHello Luke,
It worked! Thanks for the awesome support.Regards,
MehmetMarch 7, 2025 at 1:12 pm #643806
Luke NielsenMemberHello,
You are welcome! If you do not mind, can you please leave a 5 stars rating for our theme by going here: http://themeforest.net/downloads It will allow us to release more updates and provide dedicated support in the future. It would encourage our work a lot.
Have a good day!
Kind Regards
-
AuthorPosts
The topic ‘Add to Cart Button Visibility Problem in Grid View (Product Archives)’ is closed to new replies.
- You must be logged in to create new topics. Login / Register