Potential bug – product pages HTTP 500 if last order was refunded
-
The plugin will cause product pages to produce a PHP error and then fail to load IF the last order of that product was refunded (leading you to never get an order for that product again, because the product page won’t load)
[08-Oct-2024 10:08:10 UTC] PHP Fatal error: Uncaught Error: Call to undefined method Automattic\WooCommerce\Admin\Overrides\OrderRefund::get_billing_first_name() in /var/www/example.com/wp-content/plugins/wpc-smart-messages/includes/class-shortcode.php:319
Stack trace:
#0 /var/www/example.com/wp-includes/shortcodes.php(434): Wpcsm_Shortcode->recent_order()
#1 [internal function]: do_shortcode_tag()
#2 /var/www/example.com/wp-includes/shortcodes.php(273): preg_replace_callback()
#3 /var/www/example.com/wp-content/plugins/wpc-smart-messages/includes/class-frontend.php(114): do_shortcode()
#4 /var/www/example.com/wp-content/plugins/wpc-smart-messages/includes/class-frontend.php(99): Wpcsm_Frontend->display_message()
#5 /var/www/example.com/wp-includes/class-wp-hook.php(324): Wpcsm_Frontend->{closure}()
#6 /var/www/example.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#7 /var/www/example.com/wp-includes/plugin.php(517): WP_Hook->do_action()
#8 /var/www/example.com/wp-content/themes/salient/woocommerce/content-single-product.php(79): do_action()
#9 /var/www/example.com/wp-includes/template.php(812): require('...')
#10 /var/www/example.com/wp-content/plugins/woocommerce/includes/wc-core-functions.php(284): load_template()
#11 /var/www/example.com/wp-content/plugins/woocommerce/templates/single-product.php(37): wc_get_template_part()
#12 /var/www/example.com/wp-includes/template-loader.php(106): include('...')
#13 /var/www/example.com/wp-blog-header.php(19): require_once('...')
#14 /var/www/example.com/index.php(17): require('...')
#15 {main}
thrown in /var/www/example.com/wp-content/plugins/wpc-smart-messages/includes/class-shortcode.php on line 319The code needs to check that the $order object on line 319 is an instance of WC_Order (and specifically not WC_Order_Refund)
Add this below line 315 of /wpc-smart-messages/includes/class-shortcode.php to fix:
if (!$order || !($order instanceof WC_Order)) {
// Skip non-orders
continue;
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.