Title: shortcode variation_id not working
Last modified: May 11, 2023

---

# shortcode variation_id not working

 *  Resolved [kevindestrem](https://wordpress.org/support/users/kevindestrem/)
 * (@kevindestrem)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/shortcode-variation_id-not-working/)
 * 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](https://wordpress.org/support/users/kevindestrem/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [templateinvaders](https://wordpress.org/support/users/templateinvaders/)
 * (@templateinvaders)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/shortcode-variation_id-not-working/#post-16732976)
 * Hi [@kevindestrem](https://wordpress.org/support/users/kevindestrem/)
 * Thanks for the bug report. We fixed the issue in the version 2.5.0

Viewing 1 replies (of 1 total)

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

 * ![](https://ps.w.org/ti-woocommerce-wishlist/assets/icon-256x256.gif?rev=2469447)
 * [TI WooCommerce Wishlist](https://wordpress.org/plugins/ti-woocommerce-wishlist/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ti-woocommerce-wishlist/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ti-woocommerce-wishlist/)
 * [Active Topics](https://wordpress.org/support/plugin/ti-woocommerce-wishlist/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ti-woocommerce-wishlist/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ti-woocommerce-wishlist/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [templateinvaders](https://wordpress.org/support/users/templateinvaders/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/shortcode-variation_id-not-working/#post-16732976)
 * Status: resolved