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


PHP WC_Subscriptions_Order::get_item_by_subscription_key方法代碼示例

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


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

示例1: get_subscription

 /**
  * Return an associative array of a given subscriptions details (if it exists).
  *
  * @param string $subscription_key A subscription key of the form created by @see self::get_subscription_key()
  * @param deprecated don't use
  * @return array Subscription details
  * @since 1.1
  */
 public static function get_subscription($subscription_key, $deprecated = null)
 {
     if (null != $deprecated) {
         _deprecated_argument(__CLASS__ . '::' . __FUNCTION__, '1.4');
     }
     $item = WC_Subscriptions_Order::get_item_by_subscription_key($subscription_key);
     if (!empty($item)) {
         $subscription = array('order_id' => $item['order_id'], 'product_id' => $item['product_id'], 'variation_id' => $item['variation_id'], 'status' => isset($item['subscription_status']) ? $item['subscription_status'] : 'pending', 'period' => $item['subscription_period'], 'interval' => $item['subscription_interval'], 'length' => isset($item['subscription_length']) ? $item['subscription_length'] : 0, 'start_date' => isset($item['subscription_start_date']) ? $item['subscription_start_date'] : 0, 'expiry_date' => isset($item['subscription_expiry_date']) ? $item['subscription_expiry_date'] : 0, 'end_date' => isset($item['subscription_end_date']) ? $item['subscription_end_date'] : 0, 'trial_expiry_date' => isset($item['subscription_trial_expiry_date']) ? $item['subscription_trial_expiry_date'] : 0, 'failed_payments' => isset($item['subscription_failed_payments']) ? $item['subscription_failed_payments'] : 0, 'completed_payments' => isset($item['subscription_completed_payments']) ? $item['subscription_completed_payments'] : 0, 'suspension_count' => isset($item['subscription_suspension_count']) ? $item['subscription_suspension_count'] : 0, 'last_payment_date' => isset($item['subscription_completed_payments']) ? end($item['subscription_completed_payments']) : '');
     } else {
         $subscription = array();
     }
     return apply_filters('woocommerce_get_subscription', $subscription, $subscription_key, $deprecated);
 }
開發者ID:jgabrielfreitas,項目名稱:MultipagosTestesAPP,代碼行數:21,代碼來源:class-wc-subscriptions-manager.php


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