i want make text file with subject and title product with woocommerce hooks
but not work

    function my_project_updated_save_file( $woocommerce_new_product ) {
 $id = $product->get_id();

        $product->set_props( array(
            'name'              => $post_object->post_title,
            'slug'              => $post_object->post_name,
        ) );


$post_title = $product.name;
$post_url = $product.slug;

    $content = $post_title;
    $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.txt","wb");
    fwrite($fp,$content);
    fclose($fp);

}

    add_action( 'woocommerce_save_product_variation', 'my_project_updated_save_file' );

Read more here: create text file after publish product with hooks


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: