• Resolved kevindestrem

    (@kevindestrem)


    Hello there,

    Using ti-wishlist I noticed a problem with the shortcode, the variation_id attribute seem to be sometime ignored.
    On the same page, I have a product list which can have the same product with different spec, price, image (basically different variations).

    And I’m using the shortcode to place the wishlist button at the right place with the right properties. On the same page, the loop generate multiple buttons:

    [ti_wishlists_addtowishlist loop=yes product_id=4120 variation_id=4121]



    [ti_wishlists_addtowishlist loop=yes product_id=4120 variation_id=4122]

    The wishlist button appear at the right place, and works fine for individual products. But when I have multiple wc_product_variation on the same listing, the variation_id seem to be ignored. The buttons generated seem to all use the same variation id and not the one I provide.

    Looking at the plugin code addtowishlist.class.php > htmloutput I found that that the $variation_id in loop is completely ignored, and try to guess the variation to use with find_matching_product_variation()
    It feel like a strange behavior, it let you pass a variation_id property but doesn’t use it and try to guess the default one to use.

    By simply adding 2 lines to check and use an existing $variation_id, I suddenly get the expected behavior. And I can wishlist each variation individually
    if ( $variation_id ) {
    $this->variation_id = $variation_id;
    $this->variation_ids = array($variation_id);
    } else if ( $match_attributes ) {


    Am I doing something weird or is there really an issue with the plugin?

    • This topic was modified 3 years, 1 month ago by kevindestrem.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘shortcode variation_id not working’ is closed to new replies.