• I encountered a bug in this plugin . It does not send an email when a new order is sent.

    We get in the log the following message:
    payment_method 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_Paybox_Gateway_idbp->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_Customer_On_Hold_Order->trigger, WC_Email->get_content, WC_Email_Customer_On_Hold_Order->get_content_html, wc_get_template_html, wc_get_template, include(‘/plugins/woocommerce/templates/emails/customer-on-hold-order.php’), do_action(‘woocommerce_email_order_details’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails->order_details, wc_get_template, include(‘/plugins/woocommerce/templates/emails/email-order-details.php’), do_action(‘woocommerce_email_before_order_table’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Paybox_Gateway_idbp->email_instructions, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.

    To correct that you need to change the email_instructions method in the code to :

    /**

    • Add content to the WC emails.
    • @access public
    • @param WC_Order $order
    • @param bool $sent_to_admin
    • @param bool $plain_text
      */
      public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { // MUST use getter: get_payment_method()
      if (
      $this->instructions
      && ! $sent_to_admin
      && $this->id === $order->get_payment_method()
      && $order->has_status( ‘on-hhold’ )
      ) { echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL; if ( $this->receiver_phone ) { echo wpautop( '<img style="vertical-align: middle;" src="' . plugins_url( 'img/paybox-logo.png', __FILE__ ) . '" width="70px;" height="70px;">' . wptexturize( __( 'Phone Number:', 'woo-paybox-payment-gateway' ) . ' <a href="tel:' . $this->receiver_phone . '">' . $this->receiver_phone . '</a>' ) ); } if ( $this->paybox_app_link ) { echo '<a target="_blank" href="' . esc_url( $this->paybox_app_link ) . '">' . __( 'Click here to go to the paybox app', 'woo-paybox-payment-gateway' ) . '</a><br>'; } }
      }

The topic ‘Does not send email on current php/woocommerce version’ is closed to new replies.