在结单创建后将Cookie值保存为Woocommerce中的元数据

时间:2019-03-28 18:34:46

标签: php wordpress cookies woocommerce orders

我想从插件文件中保存订单元数据以显示票证ID号到电子邮件通知,我使用的代码通过cookie保存Post ID以订购元数据,但是问题是我现有的代码从thankyou.php中获取数据在woocommerce订单流程最后运行的页面,是否可以通过Cookie或任何其他方法直接从插件文件中保存数据,以便我可以轻松地在任何php页面上显示它?

我正在使用此线程How to get a cookie value in Woocommerce email notifications?中的代码,这是对我的一个问题的回答。

此功能在我想保存并显示在其他php文件中的电子邮件模板中打印票证ID,该标签为 $ post-> ID

    if ( ! function_exists( 'yith_wcevti_set_args_mail_template' ) ) {
   /**
    * Define the args to mail template
    * @param $post
    * @return array|mixed|void
    */
   function yith_wcevti_set_args_mail_template($post)
   {
    $args = array();

    $post_meta = get_post_meta($post->ID, '', true);

感谢您的帮助。

0 个答案:

没有答案