I have solved the problem above. But now I have another problem.
When I create a new product and I purchase a course it does not enrol me into the course but instead takes me to the self-enrol screen. But when I use the Sync option to automatically create courses It creates the enrolment in moodle but on the check-out screen it gives a Internal Error Message with no email being sent out but does add the course to moodle.
This is the error log below:
[27-Jan-2021 02:01:40 UTC] id was called incorrectly. Order properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::do_wc_ajax, do_action(‘wc_ajax_checkout’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->process_order_without_payment, WC_Order->payment_complete, WC_Order->save, WC_Order->status_transition, do_action(‘woocommerce_order_status_completed’), WP_Hook->do_action, WP_Hook->apply_filters, MooWoodle_Enrollment->process_order, MooWoodle_Enrollment->process_enrollment, MooWoodle_Enrollment->enrol_moodle_user, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.
[27-Jan-2021 02:01:40 UTC] id was called incorrectly. Order properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::do_wc_ajax, do_action(‘wc_ajax_checkout’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->process_order_without_payment, WC_Order->payment_complete, WC_Order->save, WC_Order->status_transition, do_action(‘woocommerce_order_status_completed’), WP_Hook->do_action, WP_Hook->apply_filters, MooWoodle_Enrollment->process_order, MooWoodle_Enrollment->process_enrollment, MooWoodle_Enrollment->enrol_moodle_user, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.
[27-Jan-2021 02:01:41 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function WC_Emails::email_header(), 1 passed in /home/fitcom/public_html/wp-includes/class-wp-hook.php on line 287 and exactly 2 expected in /home/fitcom/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php:269
Stack trace:
#0 /home/fitcom/public_html/wp-includes/class-wp-hook.php(287): WC_Emails->email_header(‘New Enrollment’)
#1 /home/fitcom/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
#2 /home/fitcom/public_html/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#3 /home/fitcom/public_html/wp-content/plugins/moowoodle/templates/emails/new-enrollment.php(11): do_action(‘woocommerce_ema…’, ‘New Enrollment’)
#4 /home/fitcom/public_html/wp-content/plugins/moowoodle/classes/class-moowoodle-template.php(26): include(‘/home/fitcom/pu…’)
#5 /home/fitcom/public_html/wp-content/plugins/moowoodle/classes/emails/class-moowoodle-email-new-enrollment.php(56): MooWoodle_Template->get_template(’emails/new-enro in /home/fitcom/public_html/wp-content/plugins/woocommerce/includes/class-wc-emails.php on line 269
[27-Jan-2021 02:01:48 UTC] PHP Warning: session_start(): Cannot start session when headers already sent in /home/fitcom/public_html/wp-content/plugins/moowoodle/moowoodle.php on line 59
Thanks for your help ??