/** * Hooks up all of Skip One transaction emails after the WooCommerce object is constructed. * * @since 1.0.0 * @access public * @static */ public static function hook_transactional_emails() { // Don't send subscription if (WC_Subscriptions::is_duplicate_site() && !defined('WCS_FORCE_EMAIL')) { return; } $skip_emails = array('next_payment_date'); foreach ($skip_emails as $email) { add_action('woocommerce_skip_one_' . $email, __CLASS__ . '::send_' . $email . '_email', 10, 2); } }
/** * Hooks up all of Subscription's transaction emails after the WooCommerce object is constructed. * * @since 1.4 */ public static function hook_transactional_emails() { // Don't send subscription if (WC_Subscriptions::is_duplicate_site() && !defined('WCS_FORCE_EMAIL')) { return; } add_action('woocommerce_subscription_status_updated', __CLASS__ . '::send_cancelled_email', 10, 2); $order_email_actions = array('woocommerce_order_status_pending_to_processing', 'woocommerce_order_status_pending_to_completed', 'woocommerce_order_status_pending_to_on-hold', 'woocommerce_order_status_failed_to_processing_notification', 'woocommerce_order_status_failed_to_completed_notification', 'woocommerce_order_status_failed_to_on-hold_notification', 'woocommerce_order_status_completed', 'woocommerce_generated_manual_renewal_order', 'woocommerce_order_status_failed'); foreach ($order_email_actions as $action) { add_action($action, __CLASS__ . '::maybe_remove_woocommerce_email', 9); add_action($action, __CLASS__ . '::send_renewal_order_email', 10); add_action($action, __CLASS__ . '::send_switch_order_email', 10); add_action($action, __CLASS__ . '::maybe_reattach_woocommerce_email', 11); } }
/** * Adds Subscriptions specific details to the WooCommerce System Status report. * * @param array $attributes Shortcode attributes. * @return array */ public static function add_system_status_items($debug_data) { $is_wcs_debug = defined('WCS_DEBUG') ? WCS_DEBUG : false; $debug_data['wcs_debug'] = array('name' => _x('WCS_DEBUG', 'label that indicates whether debugging is turned on for the plugin', 'woocommerce-subscriptions'), 'note' => $is_wcs_debug ? __('Yes', 'woocommerce-subscriptions') : __('No', 'woocommerce-subscriptions'), 'success' => $is_wcs_debug ? 0 : 1); $debug_data['wcs_staging'] = array('name' => _x('Subscriptions Mode', 'Live or Staging, Label on WooCommerce -> System Status page', 'woocommerce-subscriptions'), 'note' => '<strong>' . (WC_Subscriptions::is_duplicate_site() ? _x('Staging', 'refers to staging site', 'woocommerce-subscriptions') : _x('Live', 'refers to live site', 'woocommerce-subscriptions')) . '</strong>', 'success' => WC_Subscriptions::is_duplicate_site() ? 0 : 1); return $debug_data; }
/** * Checks if a subscription requires manual payment because the payment gateway used to purchase the subscription * did not support automatic payments at the time of the subscription sign up. Or because we're on a staging site. * * @param mixed $order A WC_Order object or the ID of the order which the subscription was purchased in. * @return bool True if the subscription exists and requires manual payments, false if the subscription uses automatic payments (defaults to false for backward compatibility). * @since 1.2 */ public static function requires_manual_renewal($order) { if ('true' == self::get_meta($order, '_wcs_requires_manual_renewal', 'false') || WC_Subscriptions::is_duplicate_site()) { $requires_manual_renewal = true; } else { $requires_manual_renewal = false; } return $requires_manual_renewal; }
/** * Checks if the subscription requires manual renewal payments. * * @access public * @return bool */ public function is_manual() { if (WC_Subscriptions::is_duplicate_site() || empty($this->payment_gateway) || isset($this->requires_manual_renewal) && 'true' == $this->requires_manual_renewal) { $is_manual = true; } else { $is_manual = false; } return $is_manual; }
/** * Adds Subscriptions specific details to the WooCommerce System Status report. * * @param array $attributes Shortcode attributes. * @return array */ public static function add_system_status_items($debug_data) { $is_wcs_debug = defined('WCS_DEBUG') ? WCS_DEBUG : false; $debug_data['wcs_debug'] = array('name' => __('WCS_DEBUG', 'woocommerce-subscriptions'), 'note' => $is_wcs_debug ? __('Yes', 'woocommerce-subscriptions') : __('No', 'woocommerce-subscriptions'), 'success' => $is_wcs_debug ? 0 : 1); $debug_data['wcs_staging'] = array('name' => __('Subscriptions Mode', 'woocommerce-subscriptions'), 'note' => WC_Subscriptions::is_duplicate_site() ? __('<strong>Staging</strong>', 'woocommerce-subscriptions') : __('<strong>Live</strong>', 'woocommerce-subscriptions'), 'success' => WC_Subscriptions::is_duplicate_site() ? 0 : 1); return $debug_data; }