Per screenshot below, I have the following errors with the rule that is supposed to remove a product from a wishlist when it has been purchased:

  1. Error: Data selector commerce-wishlist-owner:uid for parameter data is invalid.
  2. Error: Data selector commerce-wishlist-product for parameter product is invalid.

I haven't made any changes to the rule, I simple enabled the module, came to the rule edit form and this is what I saw.

I also confirmed that the rule is indeed not working. I added a product to the cart that was in my wishlist and purchased it. The product remained on my wishlist.

Screenshot of rule

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

capellic created an issue. See original summary.

capellic’s picture

Issue summary: View changes
thejacer87’s picture

this happened to me as well. brand new kickstart instance. it seemed to fix itself somehow after i clicked around for a bit in the rules. that being said, when it was supposed to be working, nothing was removed from the wishlist.

here's some relevant(or irrelevant) info from the rules log after checking out.

jcorrao’s picture

I'm currently updating and working with this as well.

I am having the same errors as in the original entry, that both of those selectors are not valid. Wondering if anyone has been able to reproduce or fix this issue?

aramboyajyan’s picture

Assigned: Unassigned » aramboyajyan

Guys thanks for reporting this. I'll have a look and keep you posted.

msweb69’s picture

Me too i have same error: Remove product from wishlist after purchase in admin/config/workflow/rules

thejacer87’s picture

so it looks like the issue is that nothing is invoking the event "After purchasing a product from a wishlist" (also nothing is invoking the "After removing a product from wishlist" event either)...

couple ways to go about this... easiest would probably just changed the event the default rule is reacting on to one of the commerce rules (ie "When an order is first paid in full", or something like that.) Or we could hook into whatever is happening around that time and invoke our event...

thejacer87’s picture

nvm, nothing to crazy needed... the rule was trying to be invoked but there must have been a change at some point to the rule that didn't get accounted for

in commerce_wishlist.module, line 344:

rules_invoke_event('commerce_wishlist_event_product_purchased', $account, $product, $node, $order);

but the event in commerce_wishlist_rules_event_info() the rule is commerce_wishlist_product_purchased. so i fixed er up, and took out the unused node variable

Status: Needs review » Needs work

The last submitted patch, 8: commerce_wishlist_errors_with_data-2709551-8.patch, failed testing.

The last submitted patch, 8: commerce_wishlist_errors_with_data-2709551-8.patch, failed testing.

The last submitted patch, 8: commerce_wishlist_errors_with_data-2709551-8.patch, failed testing.

thejacer87’s picture

Status: Needs work » Needs review

if someone could plz review this patch... i dunno why it's failing. i think the test might be messed up

caco13’s picture

I've applied the patch but didn't work for me.

Same error messages.

fbailey’s picture

Alright, figured out the issue. The rules config was just simply using the wrong event name as specified in the event_info hook. It was using the name commerce_wishlist__event_product_purchased, when it's actually named: commerce_wishlist_product_purchased. I've added a patch which should resolve these issues.

fbailey’s picture

Also note, make sure you clear your cache when you apply the patch as the rules won't reload the configuration.

fbailey’s picture

I just realized, Jace's patch will probably have to be applied alongside with mine in order for a complete fix.

fbailey’s picture

The last submitted patch, 14: commerce_wishlist_errors_with_data-2709551-14.patch, failed testing.

The last submitted patch, 14: commerce_wishlist_errors_with_data-2709551-14.patch, failed testing.

The last submitted patch, 14: commerce_wishlist_errors_with_data-2709551-14.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 17: commerce_wishlist_errors_with_data-2709551-17.patch, failed testing.

The last submitted patch, 17: commerce_wishlist_errors_with_data-2709551-17.patch, failed testing.

The last submitted patch, 17: commerce_wishlist_errors_with_data-2709551-17.patch, failed testing.

Anonymous’s picture

#17 worked for me! Thank you!