• I am going to be selling some software on our site which requires a serial number to activate the software. The serial number comes from a 3rd party service. With this service I can either manually acquire the serial number and email it to the customer, but preferably I would like to use the services APIs to connect to and retrieve the serial number then send it in a separate email (or maybe even add it to their account page).

    What is the best way to run a 3rd party API when an order completes? And make this even more complex, I need to be able to set this per product, as some products do not require to connect to this 3rd part service.

    Thoughts?

    Cheers

    https://wordpress.org/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Have a look at this demo of the woocommerce_thankyou hook as a framework for you to insert your own code to get the serial number and send the email relevant for each product:
    http://pastebin.com/zWuXPXfD

    Thread Starter streamworksaudio

    (@streamworksaudio)

    I will have to look into the woocommerce_thankyou hook!

    Thanks

    Thread Starter streamworksaudio

    (@streamworksaudio)

    I see with your example code you go through each item on the order and put it’s meta data into an array. Would this include custom attributes? As I would need to have some info for the item that is needed in order to call and get the correct serial from the API.

    In other words, could I set a custom attribute to be like ‘service_product’ and set the value to a custom id, then when I make the API call it could be http://api-url.com?product-id=%5Bcustom id from attribute service_product]?

    If that makes sense 😉

    I don’t know, I would use var_dump($item); to see what fields are present.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Run script after purchase’ is closed to new replies.