Title: Undefined array key &#8220;refund_total&#8221;
Last modified: September 9, 2026

---

# Undefined array key “refund_total”

 *  Resolved [morvy](https://wordpress.org/support/users/morvy/)
 * (@morvy)
 * [3 weeks ago](https://wordpress.org/support/topic/undefined-array-key-refund_total/)
 * Every refund initiated from the Stripe dashboard triggers a PHP warning on our
   site:
 *     ```wp-block-code
       Warning: Undefined array key "refund_total"/wp-content/plugins/woocommerce/includes/wc-order-functions.php:608
       ```
   
 * Stack (top of the app frames down):
 *     ```wp-block-code
       POST /wp-json/wc-stripe/v1/webhook -> PaymentPlugins\Stripe\Rest\Routes\V1\Webhook::handle_post_request() -> wc_stripe_process_create_refund()  (includes/wc-stripe-webhook-functions.php:180) -> wc_create_refund()                 (woocommerce/includes/wc-order-functions.php:608)
       ```
   
 * At that line WooCommerce reads the key without a guard:
 *     ```wp-block-code
       $refund_total = $args['line_items'][ $item_id ]['refund_total'];
       ```
   
 * while `qty` and `refund_tax` on the surrounding lines are `isset()`-checked. 
   So it looks like the `line_items` array built in `wc_stripe_process_create_refund()`
   can contain entries without a `refund_total` key — probably when the refund comes
   from Stripe’s side and there is no per-line data.
 * Not fatal, but it fires on every such webhook (38 occurrences here in 90 days)
   and pollutes the error log. Is `refund_total` supposed to always be set in that
   array?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Clayton R](https://wordpress.org/support/users/mrclayton/)
 * (@mrclayton)
 * [3 weeks ago](https://wordpress.org/support/topic/undefined-array-key-refund_total/#post-19015677)
 * Hi [@morvy](https://wordpress.org/support/users/morvy/)
 * Thank you for contacting Payment Plugins.
 * > Is `refund_total` supposed to always be set in that array?
 * The Stripe plugin sets the line items entry when the order has been fully refunded
   which requires restocking. The WooCommerce refund function will process the re-
   stocking if the refund arguments passed to the function contain line item info.
 * In the past this just required the quantity for each line item but not needs 
   the per line item total to avoid that PHP notice.
 * We’ve added this as a development task for the next release.
 * Kind Regards

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-array-key-refund_total%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/woo-stripe-payment/assets/icon-256x256.png?rev=2611337)
 * [Payment Plugins for Stripe WooCommerce](https://wordpress.org/plugins/woo-stripe-payment/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-stripe-payment/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-stripe-payment/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-stripe-payment/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-stripe-payment/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-stripe-payment/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Clayton R](https://wordpress.org/support/users/mrclayton/)
 * Last activity: [3 weeks ago](https://wordpress.org/support/topic/undefined-array-key-refund_total/#post-19015677)
 * Status: resolved