Undefined array key “refund_total”
-
Every refund initiated from the Stripe dashboard triggers a PHP warning on our site:
Warning: Undefined array key "refund_total"
/wp-content/plugins/woocommerce/includes/wc-order-functions.php:608Stack (top of the app frames down):
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:
$refund_total = $args['line_items'][ $item_id ]['refund_total'];while
qtyandrefund_taxon the surrounding lines areisset()-checked. So it looks like theline_itemsarray built inwc_stripe_process_create_refund()can contain entries without arefund_totalkey — 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_totalsupposed to always be set in that array?
You must be logged in to reply to this topic.