Support » Plugin: TI WooCommerce Wishlist » “The selected product isn’t a variation of %s”

  • Resolved gazchap

    (@gazchap)


    Hi there,

    Up until recently, TI Wishlist was working perfectly on a site that we manage, but now users are unable to add any products that are on their wishlist into their baskets.

    The error given is always: “The selected product isn’t a variation of %s, please choose product options by visiting %s” (where %s of course, is the name of the product)

    However, all of the products on this website are simple products so I’ve no idea why it’s expecting anything to be a variation of anything else.

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author templateinvaders

    (@templateinvaders)

    Hi @gazchap

    We need to debug your setup because can’t get the same issue. The latest updates don’t affect this part of the code also.

    You can contact us directly via support chat to provide more details.

    bb15

    (@bb15)

    Hi @gazchap do you still have this issue with “The selected product isn’t a variation of %s” ?

    I have the same problem.. did you manage to solve it? And can you tell me (us) how?

    kr,
    Bart

    Thread Starter gazchap

    (@gazchap)

    I do still have the issue yes, somehow I missed that reply from TI so I’ll get in touch via their support chat.

    bb15

    (@bb15)

    Thanks. Do you also use WPML language plugin?
    We believe that is the cause… in combination with some other plugin…

    Thread Starter gazchap

    (@gazchap)

    Not on this particular website, no, I’m afraid.

    Thread Starter gazchap

    (@gazchap)

    I found the issue in our case – we were actually creating wishlist entries ourselves programmatically through our own custom actions, and in doing so we were passing both the $product_id and $variation_id as the same number (the ID of the product in question):

    $tip = new TInvWL_Product();
    $product_add_id = $tip->add_product([
        'product_id' => $product_id,
        'variation_id' => $product_id,
        'quantity' => 1,
        'wishlist_id' => $default_wishlist['ID']
    ]);
    

    As none of our products are variable, I just had to change that line to 'varation_id' => 0 and all was well again.

    As far as I could tell, the TInvWL_Product\add_product() method should be checking if the variation_id given is actually a variation, and if not setting it to 0 – but this looks to have stopped working reliably with a recent WooCommerce update and maybe the cause of the issue for others, assuming they’re not doing custom code like we have.

    Hope this helps someone else.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.