Plugin Support
Stan
(@stantinv)
Hi @aliferis,
Yes, it’s possible. The shortcode should look like this:
Single product:
[ti_wishlists_addtowishlist product_id="93"]
Variation:
[ti_wishlists_addtowishlist product_id="93" variation_id="94"]
Regards,
Stan
Thank you – this works. I now realise I am attempting to load the shortcode after the page has loaded, using AJAX so it won’t work to do something like this
(in an on change in a form select field)
‘ jQuery(this).parents().children(‘.wishlist’).html(‘[ti_wishlists_addtowishlist product_id=”‘ + chosen_id + ‘”]’);
‘
Is it possible for me to call the underlying function?
(so I can load into the page with AJAX) ?
Thanks again
Joe
I tried this but it does not work
jQuery(this).parents().children('.wishlist').html('<div class="tinv-wraper woocommerce tinv-wishlist tinvwl-shortcode-add-to-cart">
<div class="tinv-wishlist-clear"></div><a><span class="tinvwl_add_to_wishlist-text">Add to Wishlist</span></a><div class="tinv-wishlist-clear"></div> <div class="tinvwl-tooltip">Add to Wishlist</div>
</div>');
-
This reply was modified 3 years, 7 months ago by Yui.
-
This reply was modified 3 years, 7 months ago by Yui.
Hi @aliferis
What you wrote above is just DOM changes with jQuery, not an AJAX call. Shortcode rendering on the server-side. So it’s possible to get a wishlist button with AJAX call but it will load your server for multiple buttons OR you can move a rendered button to the desired place in DOM on page load.
Sorry – I think I need to do this
OR you can move a rendered button to the desired place in DOM on page load.
I am trying to use Jquery after page load to generate a Wishlist button with a product ID
The ID comes from a user select form in the page
So, can add a button with an ID variable into the DOM with Jquery ?
thanks
JOe
How can I do this with jQuery ?
OR you can move a rendered button to the desired place in DOM on page load.
thanks for your help
Joe
Hi
Still hoping for a solution
I would like to be able to dynamically build the Wishlist button (add to Wishlist) after user selects form a standard drop down list – so I can add the product ID dynamically
using JS
Cheers
Joe