• Resolved aliferis

    (@aliferis)


    Hi

    Is there a way to add the ‘add to Wishlist’ shortcake to a page or into a template and include a product ID, so that the button that shortcode produces adds a specific product to the users Wishlist ?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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

    Thread Starter aliferis

    (@aliferis)

    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

    Thread Starter aliferis

    (@aliferis)

    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.
    Plugin Author templateinvaders

    (@templateinvaders)

    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.

    Thread Starter aliferis

    (@aliferis)

    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

    Thread Starter aliferis

    (@aliferis)

    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

    Thread Starter aliferis

    (@aliferis)

    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Product ID in shortcode’ is closed to new replies.