cart ); } /** * Inspect product-level/cart-level session data and apply subscription schemes to cart items as needed. * * @param \WC_Cart $cart * @return void */ public static function apply_subscriptions( $cart ) { foreach ( $cart->cart_contents as $cart_item_key => $cart_item ) { if ( isset( $cart_item['sps'] ) ) { // Convert the product object to a subscription, if needed. $cart->cart_contents[ $cart_item_key ] = self::apply_subscription( $cart->cart_contents[ $cart_item_key ] ); } } } }