Create a txt file as Woocommerce order status is cancelled


I need to generate a text file when an order is cancelled on Woocommerce.

This text file should be named [url removed, login to view] and placed in a folder at the root of the website

I created a function in my [url removed, login to view] 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: [url removed, login to view]

I set permissions to 777

I need someone to help me debug this function or create a new one that would work fine.

Keahlian: PHP, WooCommerce, WordPress

Lihat lebih lanjut: emu8086 create txt file, create linked list given txt file java, java create binary tree txt file, excel create txt file, create write txt file windows application asp net, create txt file cell excel macro, create txt file perl, create txt file html javascript, excel macro create txt file, parse txt file php

Tentang Pemberi kerja:
( 1 ulasan ) Albi, France

ID Proyek: #7942256

16 freelancer menawar dengan rata-rata $15/jam untuk pekerjaan ini


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 Lebih banyak

$30 USD / jam
(683 Ulasan)

Hi, I have read your post and understood your requirement. I have great experience in handling /Magento/WooCommerce/Shopify/Prestashop/VirtueMart/Joomla/OpenCart/Volusion/HTML5/CSS3/PHP/Drupal/Yii framework/Javas Lebih banyak

$25 USD / jam
(82 Ulasan)

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

$8 USD / jam
(213 Ulasan)

Hi I have gone through the details of your project and we find it well within our capabilities. I offer a wide range of services, including Web design, PHP/MySQL web application development, Open sources like Joo Lebih banyak

$8 USD / jam
(337 Ulasan)

Hello there. Wordpress dev expert ready to help you with txt creation functionality. I have more 200 good reviews in dev projects, so all will be done on highest level. Please, do not award project until we will clear Lebih banyak

$12 USD / jam
(326 Ulasan)

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 Lebih banyak

$15 USD / jam
(42 Ulasan)

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 Lebih banyak

$29 USD / jam
(99 Ulasan)

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, Lebih banyak

$15 USD / jam
(31 Ulasan)

Hi, Iam interested in your project and I will be happy to do that for you. I have experienced with these skills. I can send some previous work similar to yours please check our company portofolio here http://flowgica Lebih banyak

$10 USD / jam
(37 Ulasan)

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

$11 USD / jam
(74 Ulasan)

Hi there, Hope you are doing  great today !!  I hope, your search for right contractor end here. I have recorded a quick video for  you : [login to view URL] Working with " woo commerce”  is definitely Lebih banyak

$12 USD / jam
(31 Ulasan)

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 Lebih banyak

$12 USD / jam
(18 Ulasan)

Hi there, I have read your requirement about DEBUGGING and have more than 4 years of experience with WORDPRESS | WOOCOMMERCE WEBSITE DESIGN | DEBUGGING. :: WEBSITE DESIGNED | DEBUGGING IN WORDPRESS :: htt Lebih banyak

$12 USD / jam
(9 Ulasan)

Hello Mate! I am interested in the project you posted. Their are lot of interested people here and they have lot of different things so i dont know you will reply me or not or even read my post or not but i wa Lebih banyak

$20 USD / jam
(5 Ulasan)

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 Lebih banyak

$8 USD / jam
(3 Ulasan)

Hello, I'm keenly considering your job post. I have 5 years excellent experience in WordPress.Woocommerce. It is most user friendly cms .Gives option to create and publish pages , posts , images with admin login. Lebih banyak

$11 USD / jam
(0 Ulasan)