• Resolved ljacob

    (@ljacob)


    Hi,

    I am looking for a possibility to put a product, in this case a book, to a wishlist by clicking a standard button that is placed on an image overlay (see upper left item on the page). For that end I would need an URL or shortcode that I can call when the button is pressed.I do not use a standard product archive page.

    Is that possible with JVM WooCommerce Wishlist?

    best,
    Ludwig

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Joris van Montfort

    (@jorisvanmontfort)

    Hi Ludwig,

    I think you should use the [jvm_woocommerce_add_to_wishlist] shortcode to create the button on the place where you want it. Not a standard (self created) button.

    Even better is to add jvm_woocommerce_add_to_wishlist as a function to the correct WooCommerce hook. An example for removing the button from the default place on the arhive page is in the readme file. To remove it from the single product page use:

    
    remove_action( 'woocommerce_after_add_to_cart_button', 'jvm_woocommerce_add_to_wishlist');
    

    You should will need to find a WooCommerce hook to add it the the product image. I’m not sure if this is the correct hook but it should be close:

    
    add_action( 'woocommerce_product_thumbnails', 'jvm_woocommerce_add_to_wishlist', 20 );
    

    If you need to modify the looks of the plugin button use some custom CSS. You can also modify the CSS class assigned to the plugin button to switch between looks:

    This wil change te icon into a text version of the button for example.

    add_filter( 'jvm_add_to_wishlist_class', function($class) {
        return 'jvm_add_to_wishlist text';
    });

    You may also choose to add classnames of your own and restyle completly with your own CSS. A lot is possible, but the plugin is rather developer minded so you need to be familiar with WooCommerce hooks and adding/removing actions and filters.

    I hope this is helpful.

    Kind regards, Joris

    Plugin Contributor Joris van Montfort

    (@jorisvanmontfort)

    I had a closer look and realize this example is not a default archive page. Try the shortcode I provided.

    Kind regards and good luck, Joris

    Thread Starter ljacob

    (@ljacob)

    Joris,

    thanks a lot. I added [jvm_woocommerce_add_to_wishlist] in the link field of the button. If I click that button it will take me to “Page Not Found”. Can I pass the product ID as a parameter?

    best regards,
    Ludwig

    Plugin Contributor Joris van Montfort

    (@jorisvanmontfort)

    Hi Ludwig,

    I can see the button on one of the products on your example website. It looks like you added the shortcode on inside an a element lik this:

    <a href="[jvm_woocommerce_add_to_wishlist]"></a>

    The shortcode should not be used like this, but outside any HTML element. Maybe it’s work in progress, but it is hard to help you out like this.

    Kind regards, Joris

    Plugin Contributor Joris van Montfort

    (@jorisvanmontfort)

    The shortcode should be used within the WooCommerce loop. There is no product ID parameter but I could add it.

    You will need to call the shortcode outside a HTML element. The plugin the uses an Ajax call, triggered by a javascipt in the plugin to add the product to the wishlist.

    Please try to implement the shortcode correctly. If thats works I can make an upate for the plugin so an optional product id can be passed to the shortcode.

    Kind regard, Joris

    Thread Starter ljacob

    (@ljacob)

    Joris,

    thanks again. I fear that is beyond my rudimentary capabilities, so I will postpone the wishlist feature for the time being.

    Best,
    Ludwig

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘calling Add-to-wishlist from normal button’ is closed to new replies.