Checkout page freezing and sending excess order to admin
-
We have had some issues where the checkout has been crashing and duplicate orders are being sent, while still leaving the items in the customer’s cart.
This is the error message in the log:
[09-Nov-2021 06:11:08 UTC]
order_date 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_payment, WC_Gateway_Cheque->process_payment, WC_Order->update_status, WC_Order->save, WC_Order->status_transition, do_action('woocommerce_order_status_pending_to_on-hold'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails::send_transactional_email, do_action_ref_array('woocommerce_order_status_pending_to_on-hold_notification'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Email_New_Order->trigger, WC_Email->get_content, WC_Email_New_Order->get_content_html, wc_get_template_html, wc_get_template, include('/themes/Avada-Child/woocommerce/emails/admin-new-order.php'), do_action('woocommerce_email_order_details'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails->order_details, wc_get_template, include('/themes/Avada-Child/woocommerce/emails/email-order-details.php'), WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.
[09-Nov-2021 06:11:08 UTC] The WC_Order::email_order_items_table function is deprecated since version 3.0. Replace with wc_get_email_order_items.
The template that has been updated is email-order-details.php
This is the content of that template.
Could you please help me to update the template to include the replacement – wc_get_email_order_items?Thanks!!
<?php /** * Order details table shown in emails. * * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates/Emails * @version 3.3.1 ======= by HB - (update the version here in above line) ============ */ if ( ! defined( 'ABSPATH' ) ) { exit; } do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?> <?php if ( ! $sent_to_admin ) : ?> <h2><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?></h2> <?php else : ?> <h2><a class="link" href="<?php echo esc_url( admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ); ?>"><?php printf( __( 'Order #%s', 'woocommerce'), $order->get_order_number() ); ?></a> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2> <?php endif; ?> <table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1"> <thead> <tr> <th class="td" scope="col" style="width: 90%; text-align:left;"><?php _e( 'Product', 'woocommerce' ); ?></th> <th class="td" scope="col" style="width: 5%; text-align:left;"><?php _e( 'Qty', 'woocommerce' ); ?></th> <th class="td" scope="col" style="width: 5%; text-align:left;"><?php _e( 'Price', 'woocommerce' ); ?></th> </tr> </thead> <tbody> <?php echo $order->email_order_items_table( array( 'show_sku' => $sent_to_admin, 'show_image' => false, 'image_size' => array( 32, 32 ), 'plain_text' => $plain_text, 'sent_to_admin' => $sent_to_admin ) ); ?> </tbody> <tfoot> <?php if ( $totals = $order->get_order_item_totals() ) { $i = 0; foreach ( $totals as $total ) { $i++; ?><tr> <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th> <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td> </tr><?php } } if ( $order->get_customer_note() ) { ?> <tr> <th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Note:', 'woocommerce' ); ?></th> <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php echo wp_kses_post( wptexturize( $order->get_customer_note() ) ); ?></td> </tr> <?php } ?> </tfoot> </table> <?php if( $sent_to_admin ){ ?> <style type="text/css"> #header_wrapper{ display: none !important; } #body_content table td { padding: 15px 10px; } #template_container { border-color: #663366; } #body_content_inner { font-size: 11px; } h2{ font-size: 13px; } </style> <?php } ?> <?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>
Thanks so much in advance!
SarahThe page I need help with: [log in to see the link]
- The topic ‘Checkout page freezing and sending excess order to admin’ is closed to new replies.