• Hi,

    Just started playing with this plugin and so far so good πŸ™‚
    I did want the wishlist button to appear literally after the the ‘Add to Cart’ button rather than after the form. So I dug into the code and was happy to find a filter for me to alter the position setting new actions, yith_wcwl_positions.
    However, for some reason this filter is not getting applied. When i moved it to the add_button() function in the YITH_WCWL_Init class all was working as expected.

    Here are the exact lines I changed. You might want to do it a different way.

    $positions = apply_filters( 'yith_wcwl_positions', $this->_positions );
    if( $position != 'shortcode' )
       { add_action( $positions[$position]['hook'], create_function( '', 'echo do_shortcode( "[yith_wcwl_add_to_wishlist]" );' ), $this->_positions[$position]['priority'] ); }

    All I did was apply the filter here rather than in the __construct

    Would you be able to provide a fix in a future update so that I am not scared to click the ‘Update’ button?

    The Setting name suggests you would be using the woocommerce_after_add_to_cart_button hook. Is there a reason you decided to use the woocommerce_single_product_summary hook?

    http://wordpress.org/plugins/yith-woocommerce-wishlist/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey @enollo!

    Do you know how I could have this button show up over my thumbnails?

    Thread Starter enollo

    (@enollo)

    Hi @primaltwins,

    It really depends on the theme you are using and whether or not it alters the standard WooCommerce templates.

    Even if your theme has altered the templates, if it is well coded then the below code should move the Wishlist button to right below your product image, at which point you can use CSS to absolutely position it.

    function enollo_move_wc_wishlist_button($product) {
    	if ( shortcode_exists('yith_wcwl_add_to_wishlist') ) {
    		echo do_shortcode( "[yith_wcwl_add_to_wishlist]" );
    	}
    }
    add_action( 'woocommerce_product_thumbnails', 'enollo_move_wc_wishlist_button' );

    Make sure you select “Use shortcode” as the Position in the Wishlist settings tab.

    Now is the fun CSS part.

    in style.css or another css file add

    .yith-wcwl-add-to-wishlist {
    	position: absolute;
    	right: 0;
    	bottom: 0;
    	z-index: 1000;
    }

    Hi Enollo,

    Your code isn’t working. So I added:

    $positions = apply_filters( ‘yith_wcwl_positions’, $this->_positions );

    to the YITH_WCWL_Init class, selected “Use shortcode” as the Position in the Wishlist settings tab, added the [yith_wcwl_add_to_wishlist] to the “HTML after Add To Cart (Product Page)” in Appearance > theme options > HTML Blocks, but nothing happens. The button does not appear under the cart button.

    Any idea?

    Anyone please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Customizing the Position of "Add to Wishlist" Button’ is closed to new replies.