Hi! Interesting question. There isn’t a method for doing this directly as you are thinking. You could do End Date{sub_enddate} as the name, but this wouldn’t let you change price. And you could do Price with different prices but it wouldn’t let you change the sub_enddate.
I think the best course of action here is a small bit of jQuery to listen for a change on the variation in question and then update your sub_enddate value. I’ve thrown together some code to give you an idea what I mean, but I want to stress that this hasn’t been tested so it may have some dreadful syntax error or may need a little massaging.
$("select.variation-pay-length").change(function() {
var current_value = $(this).val();
//2 Months
if (current_value.indexOf("2 Months") >= 0) {
<?php $new_date = date("Ymd", strtotime("+2 months +1 day")); ?>
new_date = "<?php echo $new_date; echo foxyshop_get_verification("sub_enddate", $new_date); ?>";
//4 Months
} else if (current_value.indexOf("4 Months") >= 0) {
<?php $new_date = date("Ymd", strtotime("+4 months +1 day")); ?>
new_date = "<?php echo $new_date; echo foxyshop_get_verification("sub_enddate", $new_date); ?>";
}
//Set the Value
$("#fs_sub_enddate_<?php echo esc_attr($product['id']); ?>").val(new_date);
});
The basic idea is that your variation is named “Pay Length” and you have a default sub end date specified (so the field is there to edit). You also want your sub to end 1 day after the last payment. The code above would go in a javascript tag on your single product template.
Hope that helps.