Create a txt file as Woocommerce order status is cancelled
$8-15 USD/小时
Hi,
I need to generate a text file when an order is cancelled on Woocommerce.
This text file should be named [login to view URL] and placed in a folder at the root of the website
I created a function in my [login to view URL] file but it doesn't seem to work.
Here is the code:
add_action( ‘woocommerce_order_status_cancelled’, ‘imagevo_cancelled’);
function imagevo_cancelled($order_id) {
$order = new WC_Order( $order_id );
$myuser_id = (int)$order->user_id;
$user_info = get_userdata($myuser_id);
$items = $order->get_items();
$filename = get_template_directory().'commandes/'.$order_id.'.txt'; //should not be in the theme folder but at the root
foreach ($items as $item) {
if ($item['product_id']==82) {
$myfile = fopen($filename, "w"); }
}
return $myfile;
}
For information:
the destination folder is: [login to view URL]
I set permissions to 777
I need someone to help me debug this function or create a new one that would work fine.
项目ID: #7942256
关于项目
有15名威客正在参与此工作的竞标,均价$15/小时
Hi I work towards providing reliable, relevant and robust IT solutions at most competitive prices to my customers. I ensure 100% customer satisfaction so lets start Thanks
I have read your project details, and I am interested in offering my services. I provide 100% satisfaction guaranteed on all my work. Milestone is required to begin; to be released when the job has been satisfactor 更多
are you getting any errors? please provide details of errors. switching directory is no problem just need to know if u r getting the file generated or not as what is understand is the file is also not generating
I want to discuss this project with you further, let me know the best suitable time for you to schedule the meeting, Feel free to message me at any time, i used to be online 14 hrs in a day on this website so probably 更多
Hello Sir, I can do this job in few hours but I will need payment for 1 hour 29$ . There are few things missing in your code which I can see clearly. I will write the proper code to do this job and create the file. I 更多
Hello, I’d like to be considered for your project. I am a senior developer with over 20 years of experience in software development, using mainly open source technologies (PHP, Zend Framework, CodeIgniter, Apache, 更多
Hi There, Hope you are doing well. Thanks for the requirement. We have gone through your description and we are confident to deliver you best solution. Your Goal of the project and your requirement is very clear to 更多
Hello Sir, Thank you for taking the time to review our bid!. I am having strong hands over Java, PHP, HTML, Jsp, CSS, Bootstrap, JavaScript, JQuery, Mysql and other related technologies. I am a Creative Graphics Desig 更多