使用挂钩发布产品后创建文本文件

时间:2017-04-17 10:48:28

标签: wordpress webhooks hook-woocommerce

我想用woocommerce钩子制作带有主题和标题产品的文本文件 但没有工作

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' );

0 个答案:

没有答案