0

I have added custom fields to Woocommerce's checkout page.

I'm looking to take data from the custom field and place it on Wootheme's certificate plugin.

Here is an existing segment of code for woo theme's Certificate plugin. I know the answer lay in replacing the value of $certificate_heading to change what data it is drawing.

$certificate_heading = __( 'Certificate of Completion', 'sensei-certificates' ); // Certificate of Completion
    if ( isset( $this->certificate_template_fields['certificate_heading']['text'] ) && '' != $this->certificate_template_fields['certificate_heading']['text'] ) {

        $certificate_heading = $this->certificate_template_fields['certificate_heading']['text'];
        $certificate_heading = str_replace( array( '{{learner}}', '{{course_title}}', '{{completion_date}}', '{{course_place}}'  ), array( $student_name, $course->post_title, date( 'jS F Y', strtotime( $course_end_date ) ), get_bloginfo( 'name' ) ) , $certificate_heading );
    } // End If Statement

Here is a line of code that shows how the admin panel of Woocommerce pulls and displays one of the custom fields that I created on the checkout page:

echo '<p><strong>'.__('Student Drivers License').':</strong> ' . get_post_meta( $order->id, 'Student Drivers License', true ) . '</p>';
4

1 回答 1

0

您可以从自定义字段中获取数据

<?php
 get_post_meta($wpo_wcpdf->export->order->id,'Your field name',true);
?>

在您找到的同一个文件中$certificate_heading,找到$student_name变量并将其更改为您要查找的字段名称的值。

于 2015-01-12T19:17:47.023 回答