當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WC_Subscriptions_Order::calculate_next_payment_date方法代碼示例

本文整理匯總了PHP中WC_Subscriptions_Order::calculate_next_payment_date方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Subscriptions_Order::calculate_next_payment_date方法的具體用法?PHP WC_Subscriptions_Order::calculate_next_payment_date怎麽用?PHP WC_Subscriptions_Order::calculate_next_payment_date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WC_Subscriptions_Order的用法示例。


在下文中一共展示了WC_Subscriptions_Order::calculate_next_payment_date方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: change_users_subscription

 /**
  * Change the status of a subscription and show a notice to the
  * user to say when the next payment will now be made on.
  *
  * @since  1.0.0
  * @access public
  * @static
  * @param  $subscription
  * @param  $order_id
  * @param  $product_id
  * @uses   WC_Subscriptions::add_notice
  */
 public static function change_users_subscription($subscription, $order_id, $product_id)
 {
     $subscription = !is_object($subscription) ? wcs_get_subscription($subscription) : $subscription;
     $current_next_subscription_payment = WC_Subscriptions_Order::get_next_payment_date($order_id, $product_id, $from_date = '');
     // Get the date of the current next subscription.
     $next_subscription_payment = WC_Subscriptions_Order::calculate_next_payment_date($order_id, $product_id, $type = 'mysql', $current_next_subscription_payment);
     WCSO_Subscriptions_Order::update_next_payment($order_id, $next_subscription_payment);
     // Update the next payment on the subscriptions order.
     $subscription->add_order_note(__('Subscription was skipped by the subscriber from their subscription page.', 'woocommerce-skip-one'));
     // translators: placeholder is next subscription payment
     WC_Subscriptions::add_notice(sprintf(__('You next payment subscription will now be on the %s.', 'woocommerce-skip-one'), $next_subscription_payment), 'success');
 }
開發者ID:AnimalsCode,項目名稱:WooCommerce-Skip-One,代碼行數:24,代碼來源:class-wcso-user-change-status-handler.php

示例2: calculate_next_payment_date

 /**
  * Clears the payment schedule for a subscription and sets a net date 
  * 
  * @param $subscription_key string A subscription key of the form created by @see self::get_subscription_key()
  * @param $user_id int (optional) The ID of the user who owns the subscriptions. Although this parameter is optional, if you have the User ID you should pass it to improve performance.
  * @param $type string (optional) The format for the Either 'mysql' or 'timestamp'.
  * @return mixed If there is no future payment set, returns 0, otherwise it will return a date of the next payment of the type specified with $type
  * @since 1.2
  */
 public static function calculate_next_payment_date($subscription_key, $user_id = '', $type = 'mysql', $from_date = '')
 {
     $subscription = self::get_subscription($subscription_key, $user_id);
     $next_payment = WC_Subscriptions_Order::calculate_next_payment_date($subscription['order_id'], $subscription['product_id'], $type, $from_date);
     return $next_payment;
 }
開發者ID:bulats,項目名稱:chef,代碼行數:15,代碼來源:class-wc-subscriptions-manager.php


注:本文中的WC_Subscriptions_Order::calculate_next_payment_date方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。