Custom PHP for Post-Woocommerce Checkout Activity

Closed Posted 7 years ago Paid on delivery
Closed

Need some custom PHP written and run at the WooCommerce woocommerce_payment_complete hook.

When a customer orders and successfully pays for a "Set of 10" item from my site, I need to do the following:

1. Generate a long, random string of letters and numbers. This will be used as an "activation code." I'm thinking 20 characters at least, consisting of A-Z+a-z+0-9.

2. Call an API on my server to make that code "available" so that the user can use the code.

3. I'll return a "pass" or "success" or somesuch to indicate successful creation of the code. This can then be noted on the "successful_checkout" WooCommerce page or in the email receipt.

4. Email (or otherwise deliver) the "activation code" to the client using a nice template.

This should not take very long for a competent PHP/WooCommerce developer. I could do it, but it would take me a few days. One of you should be able to get it done in a day.

If you write the phrase, "I can do this PHP!" in your bid, you'll get priority consideration.

Here's the code I currently have. You can see the parts that need to be completed. If you can do this job, write back to me and let me know how you would do it.
---
add_action( 'woocommerce_payment_complete', 'htf_payment_complete' );
// this function will generate an activation code and send it to the forms server and then to the user
function htf_payment_complete( $order_id ){

$order = wc_get_order( $order_id );

foreach ( $order->get_items() as $item ) {

$pos = strpos($item['product_name'], "Set of 10" );

if ($pos === true) {

//
// set up a code they can use to add inventory on their PC
//

$_product = $order->get_product_from_item( $item );

// generate a random string of letters and numbers
$code = random_str( 20 );

// get template_name from the product; it is in the extended attribute "template-name"

// contact forms server with http://IPADDRESS/files/generate_inventory_code-src.esp?code=$code&t=template_name&qty=12

// if returns "SUCCESS," display inventory code AND send email to user with code inside
// else send error notice to SUPPORT_EMAIL_ADDRESS and display error page with request to contact SUPPORT
}
}
}

PHP WooCommerce WordPress

Project ID: #12340599

About the project

35 proposals Remote project Active 7 years ago

35 freelancers are bidding on average $21/hour for this job

leadconcept

I can do this PHP! ----- Dear Sir, I have read your project description & surely interested to discuss further, so can you please spare some times for a quick meeting? Please initiate the chat to finalize the c More

$24 USD / hour
(81 Reviews)
8.8
toinnisfree

I have read your project details, and I am interested in offering my services. I provide 100% satisfaction guaranteed on all my work. ftp details to your server will be required. Contact me at your soonest con More

$20 USD / hour
(773 Reviews)
8.3
LeadSoft

Hello, My name is Adrian. I own a software development company and I we (I) can do this PHP. I have some very experince web developers and they can implement the 4 pieces of functionality that you have described More

$22 USD / hour
(42 Reviews)
8.1
tomvnphp

Hi, I can do this PHP! I have more than 8 years experience in wordpress + woocommerce, I have read your reqs in details. I can finish this job in 1 day. Thanks

$22 USD / hour
(299 Reviews)
7.8
scriptphp87

I can do this PHP! I'm a professional programmer for web programming with php language to build the system website, Besides, I'm also expert in MySQL , HTML,HTML5,CSS, JS I'm always top in Vietnam freelancer https: More

$22 USD / hour
(232 Reviews)
7.9
latatestTech

With Freelancer Preferred badge bound to give 100% Quality (Let's Chat) Hello, A great team is here for your service!! I read the project description properly, and I agreed to fulfill 100% of all your requiremen More

$22 USD / hour
(118 Reviews)
7.2
tarekahmed

I can do this project I have 297 reviews check https://www.freelancer.com/u/tarekahmed.html I am Eng. Tarek have a Master degree of Information Technology I am a web programmer Professional in programming Mobi More

$15 USD / hour
(85 Reviews)
7.2
webbookstudio

Hello, my name is Olya. I represent Ukrainian IT Company «Webbook». We provide website design and web and app development services for organizations, public and government institutions, company or private web-pages. More

$15 USD / hour
(63 Reviews)
7.2
mmadi

Dear Client, Greetings from Flowgica technologies, I have experience with these skills. We do have similar experience doing something similar to yours therefore I am looking forward to discuss and move ahead. please ch More

$15 USD / hour
(40 Reviews)
6.9
samitalways4u

"I can do this PHP!" Hello sir, i have Experienced and understand PHP/WORDPRESS, I read the requirements and I understand what you need, I am confident that I can do it but please reply me, so that we can have a di More

$15 USD / hour
(89 Reviews)
7.2
DSAssociates

Hello There, "I CAN DO THIS PHP WORK!" 'Very excited and glad to see that you are from U.S.A, as i visit frequently to catch up with my clients.. My name is DS, New Zealand based freelance designer/developer here. W More

$23 USD / hour
(28 Reviews)
6.3
RITESHBATHWAL

"I can do this PHP!" Hello Sir, I will do this job in 1 day = 8 hours. The code will be hooked to the same hook you pointed out and random 20 character code will be generated. I have experience in generating beautif More

$20 USD / hour
(170 Reviews)
6.6
solution4you

Hi ! I will be happy to help you with this. I will need more explanation but I understand what you want. I will need full access to your website to achieve the task. Hope to do business with you. Thanks.

$22 USD / hour
(145 Reviews)
6.4
prashant8490

I can do this PHP! I can really do this easily. i am having 5+ years experience in wordpress development https://www.freelancer.com/u/prashant8490.html lets discuss about your project in detail. waiting for More

$16 USD / hour
(87 Reviews)
5.8