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_variationon 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 codeaddtowishlist.class.php > htmloutputI found that that the$variation_idin loop is completely ignored, and try to guess the variation to use withfind_matching_product_variation()
It feel like a strange behavior, it let you pass avariation_idproperty 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 individuallyif ( $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?
The topic ‘shortcode variation_id not working’ is closed to new replies.