is_recurring() && ! $chosen_product) {
$chosen_product = $product;
}
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();
}
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;
',
wp_json_encode($force_different_durations),
wp_json_encode($legacy_mode)
),
'after'
);
if (null !== $first_recurring_product) {
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;
}
if (!data.duration_unit && !wu_force_different_durations) {
data.duration_unit = %s;
}
return data;
});
",
wp_json_encode($first_recurring_product->get_duration()),
wp_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 esc_html(str_replace(wu_get_currency_symbol(), '', wu_format_currency($n)));
?>
get_price_variation($freq, 'month');
if ( ! $price_variation) {
continue;
}
?>
is_recurring() ? __('/mo', 'wp-multisite-waas') : '';
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-multisite-waas'),
12 => __('yearly', 'wp-multisite-waas'),
];
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-multisite-waas'), wu_format_currency($price_variation['amount']), $string);
$extra_check_for_annual = '';
if (12 === $freq) {
$extra_check_for_annual = ' || (duration == "1" && duration_unit == "year")';
}
echo "- $text
";
}
}
?>
get_pricing_table_lines() as $key => $line) : ?>
-