User becomes an affiliate upon purchase of product

We used both this https://businessbloomer.com/solved-woocommerce-check-product-id-order/ and this https://gist.github.com/eggemplo/4b1859c4fea4ddb66340c3df177d8065 to set it up so when a customer buys a specific product from our store they are registered as an affiliate but it does not work. Please see our code: https://pastebin.com/cVEv7tPw and let us know what we did wrong?

Thank you so much!!

Posted in

Comments

One response to “User becomes an affiliate upon purchase of product”

  1. Hi Carolyn,

    Please have a look at this snippet https://pastebin.com/raw/FD45ZwJt. I think this is what you need for this feature.
    Also, keep in mind that if you allow guest checkouts, the affiliate will be created but with no credentials.

    Kind regards,
    George

Share