Product Icon

WooCommerce Subscriptions

Trending
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

Closed

Last updated: May 13, 2026

1 comment

Log in to comment on this feature request.

  1. iliadiol says:

    Hey there! Thank you for getting in touch. This looks like a support question, rather than a feature request. To get help with this, I encourage you to get in touch with our support team at: https://woocommerce.com/my-account/contact-support/.

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.