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)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #643099

    uysalmehmet.092
    Participant

    Hello,

    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,
    Mehmet

    #643165

    Luke Nielsen
    Member

    Hello,

    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

    #643755

    uysalmehmet.092
    Participant

    Hello,

    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,
    Mehmet

    #643789

    Luke Nielsen
    Member

    Hello,

    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

    #643801

    uysalmehmet.092
    Participant

    Hello Luke,
    It worked! Thanks for the awesome support.

    Regards,
    Mehmet

    #643806

    Luke Nielsen
    Member

    Hello,

    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

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Add to Cart Button Visibility Problem in Grid View (Product Archives)’ is closed to new replies.