is_type( 'variable' ) ) { $product = wc_get_product( $product->get_meta( '_subscrpt_convertation_default_variation_for_renewal', true ) ); if ( ! $product ) { if ( ! is_admin() ) { wc_add_notice( __( 'Subscription early renewal order creation failed due to product deletion !', 'sdevs_subscrpt' ), 'error' ); } return false; } } $product_args = array( 'name' => $product->get_name(), 'subtotal' => $product->get_price() * $order_item->get_quantity(), 'total' => $product->get_price() * $order_item->get_quantity(), ); return $product_args; } /** * Filter renewal item's meta. * * @param array $item_meta Item meta. * @param \WC_Product $product Product Object. * * @return array */ public function filter_renewal_item_meta( $item_meta, $product ) { if ( 'updated' !== get_option( 'subscrpt_renewal_price', 'subscribed' ) || ! $product ) { return $item_meta; } if ( $product->is_type( 'variable' ) ) { $product = wc_get_product( $product->get_meta( '_subscrpt_convertation_default_variation_for_renewal', true ) ); if ( ! $product ) { return $item_meta; } } $timing_per = $product->get_meta( '_subscrpt_timing_per' ); $timing_option = $product->get_meta( '_subscrpt_timing_option' ); return array( 'time' => empty( $timing_per ) ? 1 : $timing_per, 'type' => $timing_option, 'trial' => null, ); } /** * After Expired Subscription. * * @param int $subscription_id Subscription ID. */ public function after_subscription_expired( $subscription_id ) { if ( subscrpt_is_auto_renew_enabled() ) { Helper::create_renewal_order( $subscription_id ); } } }