Product Icon

WooCommerce Subscriptions

by  Woo
Let customers subscribe to your products or services and pay on a weekly, monthly or annual basis.

Please correct class-wcs-switch-cart-item

The issue is as follows:

If the user tries to upgrade to/from a subscription that has zero cost gets this error:

Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /public_html/wp-content/plugins/woocommerce-subscriptions/includes/switching/class-wcs-switch-cart-item.php:208nStack trace:n#0

The solution is to convert the line of code 208

$new_price_per_day = ( WC_Subscriptions_Product::get_price( $this->product ) * $this->cart_item[‘quantity’] ) / $days_in_new_cycle;

to this:
$new_price_per_day = ( (float) WC_Subscriptions_Product::get_price( $this->product ) * $this->cart_item[‘quantity’] ) / $days_in_new_cycle;

You may also need to do something similar in the previous method:

public function get_old_price_per_day()

Author

dimitrisv3d0387edf6

Current Status

Open

Last updated: September 7, 2023

0 comments

Log in to comment on this feature request.