woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
235 stars 206 forks source link

Showing Notice on the Cart when clicking 'Order Again' button #2406

Open dineshinau opened 2 years ago

dineshinau commented 2 years ago

Describe the bug When we click on the 'Order Again' button from Thank you page for the completed order then on adding the products to cart showing a notice 'Undefined index: line_total'

To Reproduce

  1. Place an order using any gateway including stripe also and stay on thank you page.
  2. Mark the order status as completed from admin login.
  3. Refresh the thank you page.
  4. Click on the 'Order again' button.
  5. See the error in the console using any debugger extension. In my case, I used the PHP Console chrome extension and the 'WP PHP Console' WordPress plugin. https://wordpress.org/plugins/wp-php-console/

Expected behavior It should not show any notice while adding products to the cart.

Screenshots https://www.awesomescreenshot.com/image/31090568?key=c875d33a669c7f430449d9cf913aa8d3

Environment (please complete the following information):

Additional context Here is the demonstration video. https://www.awesomescreenshot.com/video/10352763?key=b852331a983d31beac7d6edd228cd74d

dougaitken commented 1 year ago

Hey @dineshinau

I appreciate some time has passed since the original comment, thanks for your patience.

Place an order using any gateway including stripe also and stay on thank you page.

Given you mention this happens with "any" payment gateway, can you give me context about why you believe this is related to Stripe?

dineshinau commented 1 year ago

Hello @dougaitken

Thanks for your reply. Yes, I believe this is related to Stripe because the notice not displaying if we keep the Stripe plugin disabled. And also, the backtrace of functions indicates the file names from the Stripe plugin's folder.

Please have a look at the screen recording below. https://www.awesomescreenshot.com/video/14186034?key=78f55ee62abb5ca77d864ae3e4e3adb2

You can find the line numbers also from the below backtrace. It might help you in finding the root cause.

content.js:43 E_NOTICE Undefined index: line_total - C:/wamp64/www/wkmp/wp-includes/class-wp-list-util.php:170

21 C:/wamp64/www/wkmp/wp-includes/functions.php:5189 - WP_List_Util->pluck('line_total', NULL)

20 C:/wamp64/www/wkmp/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1503 - wp_list_pluck(Array[1], 'line_total')

19 C:/wamp64/www/wkmp/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-payment-request.php:603 - WC_Cart->get_shipping_packages()

18 C:/wamp64/www/wkmp/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-payment-request.php:879 - WC_Stripe_Payment_Request->allowed_items_in_cart()

17 C:/wamp64/www/wkmp/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-payment-request.php:757 - WC_Stripe_Payment_Request->should_show_payment_request_button()

16 C:/wamp64/www/wkmp/wp-includes/class-wp-hook.php:308 - WC_Stripe_Payment_Request->scripts('')

15 C:/wamp64/www/wkmp/wp-includes/class-wp-hook.php:332 - WP_Hook->apply_filters(NULL, Array[1])

14 C:/wamp64/www/wkmp/wp-includes/plugin.php:517 - WP_Hook->do_action(Array[1])

13 C:/wamp64/www/wkmp/wp-includes/script-loader.php:2180 - do_action('wp_enqueue_scr...')

12 C:/wamp64/www/wkmp/wp-includes/class-wp-hook.php:308 - wp_enqueue_scripts('')

11 C:/wamp64/www/wkmp/wp-includes/class-wp-hook.php:332 - WP_Hook->apply_filters(NULL, Array[1])

10 C:/wamp64/www/wkmp/wp-includes/plugin.php:517 - WP_Hook->do_action(Array[1])

9 C:/wamp64/www/wkmp/wp-includes/general-template.php:3043 - do_action('wp_head')

8 C:/wamp64/www/wkmp/wp-content/themes/storefront/header.php:18 - wp_head()

7 C:/wamp64/www/wkmp/wp-includes/template.php:783 - require_once('C:\wamp64\ww...')

6 C:/wamp64/www/wkmp/wp-includes/template.php:718 - load_template('C:\wamp64\ww...', true, Array[0])

5 C:/wamp64/www/wkmp/wp-includes/general-template.php:48 - locate_template(Array[1], true, true, Array[0])

4 C:/wamp64/www/wkmp/wp-content/themes/storefront/template-fullwidth.php:10 - get_header()

3 C:/wamp64/www/wkmp/wp-includes/template-loader.php:106 - include('C:\wamp64\ww...')

2 C:/wamp64/www/wkmp/wp-blog-header.php:19 - require_once('C:\wamp64\ww...')

1 C:/wamp64/www/wkmp/index.php:17 - require('C:\wamp64\ww...')

Thanks!!

MehbubRashid commented 1 year ago

facing the same issue