/** * Make sure a synchronised subscription's price includes a free trial, unless it's first payment is today. * * @since 1.5 */ public static function maybe_unset_free_trial($total) { global $woocommerce; foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item) { if (self::is_product_synced($cart_item['data'])) { $woocommerce->cart->cart_contents[$cart_item_key]['data']->subscription_trial_length = WC_Subscriptions_Product::get_trial_length(WC_Subscriptions_Cart::get_items_product_id($cart_item)); } } return $total; }
/** * Hid the trial period for a synchronised subscription unless the related product actually has a trial period (because * we use a trial period to set the original order totals to 0). * * Deprecated because free trials are no longer displayed on cart totals, only the first renewal date is displayed. * * @since 1.5 * @deprecated 2.0 */ public static function maybe_hide_free_trial($subscription_details) { _deprecated_function(__METHOD__, '2.0'); $cart_item = self::cart_contains_synced_subscription(); if (false !== $cart_item && !self::is_product_prorated($cart_item['data'])) { // cart contains a sync $product_id = WC_Subscriptions_Cart::get_items_product_id($cart_item); if (wc_price(0) == $subscription_details['initial_amount'] && 0 == $subscription_details['trial_length']) { $subscription_details['initial_amount'] = ''; } } return $subscription_details; }