本文整理汇总了PHP中WC_Subscriptions_Manager::requires_manual_renewal方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Subscriptions_Manager::requires_manual_renewal方法的具体用法?PHP WC_Subscriptions_Manager::requires_manual_renewal怎么用?PHP WC_Subscriptions_Manager::requires_manual_renewal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Subscriptions_Manager
的用法示例。
在下文中一共展示了WC_Subscriptions_Manager::requires_manual_renewal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_generate_manual_renewal_order
/**
* Generate an order to record a subscription payment.
*
* This function is hooked to the scheduled subscription payment hook to create a pending
* order for each scheduled subscription payment.
*
* When a payment gateway calls the @see WC_Subscriptions_Manager::process_subscription_payment()
* @see WC_Order::payment_complete() will be called for the renewal order.
*
* @param $user_id int The id of the user who purchased the subscription
* @param $subscription_key string A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key()
* @since 1.2
*/
public static function maybe_generate_manual_renewal_order($user_id, $subscription_key)
{
if (WC_Subscriptions_Manager::requires_manual_renewal($subscription_key, $user_id)) {
$subscription = WC_Subscriptions_Manager::get_users_subscription($user_id, $subscription_key);
self::generate_renewal_order($subscription['order_id'], $subscription['product_id'], 'child');
}
}
示例2: maybe_generate_manual_renewal_order
/**
* Generate an order to record a subscription payment.
*
* This function is hooked to the scheduled subscription payment hook to create a pending
* order for each scheduled subscription payment.
*
* When a payment gateway calls the @see WC_Subscriptions_Manager::process_subscription_payment()
* @see WC_Order::payment_complete() will be called for the renewal order.
*
* @param int $user_id The id of the user who purchased the subscription
* @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key()
* @since 1.2
*/
public static function maybe_generate_manual_renewal_order($user_id, $subscription_key)
{
if (WC_Subscriptions_Manager::requires_manual_renewal($subscription_key, $user_id)) {
$subscription = WC_Subscriptions_Manager::get_subscription($subscription_key);
$renewal_order_id = self::generate_renewal_order($subscription['order_id'], $subscription['product_id'], array('new_order_role' => 'child'));
do_action('woocommerce_generated_manual_renewal_order', $renewal_order_id);
}
}
示例3: maybe_generate_manual_renewal_order
/**
* Generate an order to record a subscription payment.
*
* This function is hooked to the scheduled subscription payment hook to create a pending
* order for each scheduled subscription payment.
*
* When a payment gateway calls the @see WC_Subscriptions_Manager::process_subscription_payment()
* @see WC_Order::payment_complete() will be called for the renewal order.
*
* @param int $user_id The id of the user who purchased the subscription
* @param string $subscription_key A subscription key of the form created by @see WC_Subscriptions_Manager::get_subscription_key()
* @since 1.2
*/
public static function maybe_generate_manual_renewal_order($user_id, $subscription_key)
{
if (WC_Subscriptions_Manager::requires_manual_renewal($subscription_key, $user_id)) {
$subscription = WC_Subscriptions_Manager::get_subscription($subscription_key);
// $0 renewals don't require a pending renewal order, instead a paid renewal order will be created by WC_Subscriptions_Manager::maybe_process_subscription_payment()
if (WC_Subscriptions_Order::get_recurring_total($subscription['order_id']) > 0) {
$renewal_order_id = self::generate_renewal_order($subscription['order_id'], $subscription['product_id'], array('new_order_role' => 'child'));
do_action('woocommerce_generated_manual_renewal_order', $renewal_order_id);
}
}
}
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:24,代码来源:class-wc-subscriptions-renewal-order.php