• Resolved krut1

    (@krut1)


    Hey people. We are using 2 plugins together for our customer.

    Kadence WooCommerce Email Designer uses Mockup Order if the user don’t have any orders.

    Germanized for WooCommerce tries to add a payment link to the email:

    // Pay now button
    add_action( 'woocommerce_email_before_order_table', array( $this, 'email_pay_now_button' ), 0, 1 );

    The email_pay_now_button function does not use an $order, but its id ($order->get_id()). And since the order does not exist on its own, a further call to the wc_get_order function throws an error.

    Is it possible to add some checks there:

    public function add_payment_link( $order_id ) {
    
      $enabled = true;
    
      if ( get_option( 'woocommerce_gzd_order_pay_now_button' ) === 'no' ) {
        $enabled = false;
      }
    
      $order = wc_get_order( $order_id );
    
      // PLEASE add this next line
      if ( !$order ) return;
    
      if ( ! $order->needs_payment() ) {
        $enabled = false;
      }
    
      ...
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter krut1

    (@krut1)

    If you need Stack trace:

    [14-Jun-2020 22:55:10 UTC] PHP Fatal error:  Uncaught Error: Call to a member function needs_payment() on bool in /wordpress/wp-content/plugins/woocommerce-germanized/includes/class-wc-gzd-checkout.php:417
    Stack trace:
    #0 /wordpress/wp-content/plugins/woocommerce-germanized/includes/class-wc-gzd-emails.php(715): WC_GZD_Checkout->add_payment_link()
    #1 /wordpress/wp-includes/class-wp-hook.php(289): WC_GZD_Emails->email_pay_now_button()
    #2 /wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
    #3 /wordpress/wp-includes/plugin.php(478): WP_Hook->do_action()
    #4 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/templates/woo/emails/email-order-details.php(142): do_action()
    #5 /wordpress/wp-content/plugins/woocommerce/includes/wc-core-functions.php(251): include('/var/www/wireca...')
    #6 /wordpress/wp-content/plugins/woocommerce/includes/class-wc-emails.php(419): wc_get_template()
    #7 /wordpress/wp-includes/class-wp-hook.php(287): WC_Emails->order_details()
    #8 /wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
    #9 /wordpress/wp-includes/plugin.php(478): WP_Hook->do_action()
    #10 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/templates/woo/emails/customer-processing-order.php(45): do_action()
    #11 /wordpress/wp-content/plugins/woocommerce/includes/wc-core-functions.php(251): include('/var/www/wireca...')
    #12 /wordpress/wp-content/plugins/woocommerce/includes/wc-core-functions.php(270): wc_get_template()
    #13 /wordpress/wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-processing-order.php(113): wc_get_template_html()
    #14 /wordpress/wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(540): WC_Email_Customer_Processing_Order->get_content_html()
    #15 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/includes/class-kadence-woomail-preview.php(727): WC_Email->get_content()
    #16 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/includes/class-kadence-woomail-preview.php(767): Kadence_Woomail_Preview::get_preview_email()
    #17 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/preview.php(40): Kadence_Woomail_Preview::print_preview_email()
    #18 /wordpress/wp-content/plugins/kadence-woocommerce-email-designer/includes/class-kadence-woomail-preview.php(200): include('/var/www/wireca...')
    #19 /wordpress/wp-includes/class-wp-hook.php(287): Kadence_Woomail_Preview->set_up_preview()
    #20 /wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
    #21 /wordpress/wp-includes/plugin.php(544): WP_Hook->do_action()
    #22 /wordpress/wp-includes/class-wp.php(388): do_action_ref_array()
    #23 /wordpress/wp-includes/class-wp.php(735): WP->parse_request()
    #24 /wordpress/wp-includes/functions.php(1274): WP->main()
    #25 /wordpress/wp-blog-header.php(16): wp()
    #26 /wordpress/index.php(17): require('/var/www/wireca...')
    #27 {main}
      thrown in /wordpress/wp-content/plugins/woocommerce-germanized/includes/class-wc-gzd-checkout.php on line 417
    • This reply was modified 4 years, 9 months ago by krut1.
    Plugin Author vendidero

    (@vendidero)

    Thread Starter krut1

    (@krut1)

    thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Kompartibility with Kadence WooCommerce Email Designer’ is closed to new replies.