• Resolved opicron

    (@opicron)


    For the storefront theme it might be ‘nicer’ to add the button inside the div gridlist-buttonwrap instead of outside/afterwards.

    Benefits in my plain storefront theme is that the favorite button is easier to style. Especially keeping in mind the [view cart] button which appears after adding the product to cart.

    For now I have added the following code to add the button inside the div. I would like to hear your thoughts about this.

    file: www-functions.php
    line: 66
    code:

    add_filter( 'gridlist_button_wrap_end', 'jvm_filter_gridlist_button_wrap_end', 10, 1 );
    function jvm_filter_gridlist_button_wrap_end( $output ) {
        return jvm_woocommerce_add_to_wishlist().'</div>'; // this is the default output
    }

    CSS:

    .gridlist-buttonwrap {
      text-align:center;
    }
    
    .gridlist-buttonwrap a {
      display: inline-block;
    }
    
    .added_to_cart {
      float: right;
      margin-left: 0px;
      margin-right: 2em; /*not the very best solution but good for now*/
    }
    • This topic was modified 6 years, 2 months ago by opicron.
    • This topic was modified 6 years, 2 months ago by opicron.
    • This topic was modified 6 years, 2 months ago by opicron.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Joris van Montfort

    (@jorisvanmontfort)

    Just for my understanding: Wat view are we talking about? Single product or category? I can’t seem to find the gridlist-buttonwrap div you ar referring to.

    You could remove the jvm_woocommerce_add_to_wishlist completely and add it to whatever woocommerce hook you want.

    
    remove_action( 'woocommerce_after_shop_loop_item', 'jvm_woocommerce_add_to_wishlist', 15);
    remove_action( 'woocommerce_after_add_to_cart_button', 'jvm_woocommerce_add_to_wishlist' );
    
    add_action( 'woocommerce_hook_i_want_to use', 'jvm_woocommerce_add_to_wishlist' );
    
    Thread Starter opicron

    (@opicron)

    The current view is the archive-product. Yes I will use the custom hook in an snippet.

    PS: Now that I think of it, the gridlist wrapper might be from another plugin. Completely forgot about that one, sorry.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Request/Improvement: Add button to gridlist-buttonwrap div’ is closed to new replies.