使用WooCommerce订阅插件:
我正在寻找一种方法来自动生成简单订阅的开始日期(以及结束日期)。
我们已尝试续订同步付款日期,但出于各种原因,我们已更改为不续订但仅持续1年的订阅。之后将需要新订单(此客户有续订问题)。
客户希望所有订阅在31日到期时到期,无论他们何时购买。
我假设有一种方法可以通过functions.php文件来完成,但我找不到任何有用的文档。
有没有人知道如何在创建订单时修改开始日期?
谢谢。
// validate the start_date field
if ( ! is_string( $args['start_date'] ) || false === wcs_is_datetime_mysql_format( $args['start_date'] ) ) {
return new WP_Error( 'woocommerce_subscription_invalid_start_date_format', _x( 'Invalid date. The date must be a string and of the format: "Y-m-d H:i:s".', 'Error message while creating a subscription', 'woocommerce-subscriptions' ) );
} else if ( wcs_date_to_time( $args['start_date'] ) > current_time( 'timestamp', true ) ) {
return new WP_Error( 'woocommerce_subscription_invalid_start_date', _x( 'Subscription start date must be before current day.', 'Error message while creating a subscription', 'woocommerce-subscriptions' ) );
}