Product Icon

Buy Again for WooCommerce

Using Buy Again for WooCommerce your customers can quickly re-purchase the products which they had purchased earlier in your site.

Buy Again for WooCommerce plugin – error in php8

Hi,
we use Buy Again for WooCommerce

https://flintop.com/product/buy-again-for-woocommerce/
V5.1.0

CRITICAL Uncaught TypeError: Unsupported operand types: string + int
in /wp-content/plugins/buy-again-for-woocommerce/inc/class-bya-order-handler.php:196

means that on line 196 of the Buy Again for WooCommerce plugin an attempt is made to add a string and a number, which is no longer silently converted in PHP 8+, but throws an error.

You can fix it so: in Line: 196

$args[‘order_count’] = (int) $customer_obj->get_order_count() + (int) $bya_product_obj->get_order_count();

in lines 197 and 198 also cast to (int)

Please inform me when this has been fixed 😊

best regards Rafael

Author

Carsten Stech

Current Status

Completed

Last updated: June 10, 2025

2 comments

Log in to comment on this feature request.

  1. llibresgrafics says:

    I also get this error.

  2. nothin7 says:

    Thank you Rafael!

    Flintop, please apply this fix. These errors have resulted in Checkout issues for 12 customers. Here are a few of the support emails received:

    Julia: This was made in error and duplicate! We have another order – 77325 that was also sent as a confirmation. When I was trying to check out, it gave me an error, so I tried again and then I got two confirmations. Please cancel and refund!

    Brittany: When I would click submit after putting in the credit card information the screen would grey out a little and then a red error message appeared at the top saying please check the following information. I didn’t realize I was making multiple purchases when clicking submit again. It just did not seem like the payments were going through. Thank you so much for getting this figured out for me. I appreciate your time.

    Cassidie: The payment said it did not go through and apparently it did 3 times. I need to cancel order 77299 and 77300!

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.