is_recurring() && $chosen_product == false) {
$chosen_product = $product;
} // end if;
return $chosen_product;
});
$legacy_mode = array_reduce($products_to_reduce, function($all_have_same_duration, $product) use ($first_recurring_product) {
if ($product && $product->is_recurring()) {
$all_have_same_duration = $first_recurring_product->get_recurring_description() == $product->get_recurring_description();
} // end if;
return $all_have_same_duration;
});
wp_add_inline_script('wu-checkout', sprintf('
/**
* Force different durations.
*/
window.wu_force_different_durations = %s;
window.wu_legacy_mode = %s;
', json_encode($force_different_durations), json_encode($legacy_mode)), 'after');
if ($first_recurring_product !== null) {
wp_add_inline_script('wu-checkout', sprintf("
/**
* Add durations if necessary.
*/
wp.hooks.addFilter('wu_before_form_init', 'next-press/wp-ultimo', function(data) {
data.wu_force_different_durations = wu_force_different_durations;
data.wu_legacy_mode = wu_legacy_mode;
if (!data.duration && !wu_force_different_durations) {
data.duration = %s;
} // end if;
if (!data.duration_unit && !wu_force_different_durations) {
data.duration_unit = %s;
} // end if;
return data;
});
", json_encode($first_recurring_product->get_duration()), json_encode($first_recurring_product->get_duration_unit())), 'after');
}
?>
get_id()}"; ?> lift wu-plan plan-tier wu-flex-1 is_featured_plan() ? 'callout' : ''); ?> wu-flex wu-flex-col wu-justify-between"
v-show="wu_force_different_durations || (duration && wu_legacy_mode) || (( (!duration) || duration == get_duration(); ?> && duration_unit == 'get_duration_unit(); ?>' ) || get_pricing_type() !== 'paid'); ?>)"
>
is_featured_plan()) : ?>
get_name(); ?>
get_pricing_type() === 'free') :
?>
get_pricing_type() === 'contact_us') :
?>
get_currency()); ?>
get_amount();
echo str_replace(wu_get_currency_symbol(), '', wu_format_currency($n));
?>
get_price_variation($freq, 'month');
if (!$price_variation) {
continue;
} // end if;
?>
is_recurring() ? __('/mo', 'wp-ultimo') : '';
echo (!$symbol_left ? wu_get_currency_symbol() : '').' '.$symbol;
?>
is_recurring() ? $product->get_recurring_description() : '';
echo (!$symbol_left ? wu_get_currency_symbol() : '').' '.$symbol;
?>
get_description(); ?>
__('every 3 months', 'wp-ultimo'),
12 => __('yearly', 'wp-ultimo'),
);
foreach ($prices_total as $freq => $string) {
$price_variation = $product->get_price_variation($freq, 'month');
if (!$price_variation || $product->get_pricing_type() == 'free' || $product->get_pricing_type() == 'contact_us') {
echo "- -
";
} else {
$text = sprintf(__('%1$s, billed %2$s', 'wp-ultimo'), wu_format_currency($price_variation['amount']), $string);
$extra_check_for_annual = '';
if ($freq === 12) {
$extra_check_for_annual = ' || (duration == "1" && duration_unit == "year")';
} // end if;
echo "- $text
";
} // end if;
} // end foreach;
?>
get_pricing_table_lines() as $key => $line) : ?>
-