Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Created September 27, 2016 23:03
Show Gist options
  • Save thenbrent/4a02b409e60b1475eca8a7666c836a99 to your computer and use it in GitHub Desktop.
Save thenbrent/4a02b409e60b1475eca8a7666c836a99 to your computer and use it in GitHub Desktop.
List of actions and filters deprecated in WooCommerce Subscriptions v2.0. Raw
<?php
$deprecated_actions = array(
'woocommerce_scheduled_subscription_payment' => 'scheduled_subscription_payment',
'woocommerce_subscription_payment_complete' => 'processed_subscription_payment',
'woocommerce_subscription_renewal_payment_complete' => 'processed_subscription_renewal_payment',
'woocommerce_subscriptions_paid_for_failed_renewal_order' => 'woocommerce_subscriptions_processed_failed_renewal_order_payment',
'woocommerce_subscriptions_pre_update_payment_method' => 'woocommerce_subscriptions_pre_update_recurring_payment_method',
'woocommerce_subscription_payment_method_updated' => 'woocommerce_subscriptions_updated_recurring_payment_method',
'woocommerce_subscription_failing_payment_method_updated' => 'woocommerce_subscriptions_changed_failing_payment_method',
'woocommerce_subscription_payment_failed' => 'processed_subscription_payment_failure',
'woocommerce_subscription_change_payment_method_via_pay_shortcode' => 'woocommerce_subscriptions_change_payment_method_via_pay_shortcode',
'subscriptions_put_on_hold_for_order' => 'subscriptions_suspended_for_order',
'woocommerce_subscription_status_active' => 'activated_subscription',
'woocommerce_subscription_status_on-hold' => array( 'suspended_subscription', 'subscription_put_on-hold' ),
'woocommerce_subscription_status_cancelled' => 'cancelled_subscription',
'woocommerce_subscription_status_on-hold_to_active' => 'reactivated_subscription',
'woocommerce_subscription_status_expired' => 'subscription_expired',
'woocommerce_scheduled_subscription_trial_end' => 'subscription_trial_end',
'woocommerce_scheduled_subscription_end_of_prepaid_term' => 'subscription_end_of_prepaid_term',
);
$deprecated_filters = array(
// Subscription Meta Filters
'woocommerce_subscription_payment_failed_count' => 'woocommerce_subscription_failed_payment_count',
'woocommerce_subscription_payment_completed_count' => 'woocommerce_subscription_completed_payment_count',
'woocommerce_subscription_get_end_date' => 'woocommerce_subscription_expiration_date',
'woocommerce_subscription_get_trial_end_date' => 'woocommerce_subscription_trial_expiration_date',
'woocommerce_subscription_date_updated' => 'woocommerce_subscriptions_set_expiration_date',
'woocommerce_subscriptions_product_expiration_date' => 'woocommerce_subscription_calculated_expiration_date',
'woocommerce_subscription_date_updated' => 'woocommerce_subscription_set_next_payment_date',
'woocommerce_subscription_get_last_payment_date' => 'woocommerce_subscription_last_payment_date',
'woocommerce_subscription_calculated_next_payment_date' => 'woocommerce_subscriptions_calculated_next_payment_date',
'woocommerce_subscription_date_updated' => 'woocommerce_subscriptions_set_trial_expiration_date',
'wcs_subscription_statuses' => array(
'woocommerce_subscriptions_custom_status_string', //no replacement as Subscriptions now uses wcs_get_subscription_statuses() for everything (the deprecator could use 'wc_subscription_statuses' and loop over all statuses to set it in the returned value)
'woocommerce_subscriptions_status_string',
),
// Renewal Filters
'wcs_renewal_order_items' => 'woocommerce_subscriptions_renewal_order_items',
'wcs_renewal_order_meta_query' => 'woocommerce_subscriptions_renewal_order_meta_query',
'wcs_renewal_order_meta' => 'woocommerce_subscriptions_renewal_order_meta',
'wcs_renewal_order_item_name' => 'woocommerce_subscriptions_renewal_order_item_name',
'wcs_users_resubscribe_link' => 'woocommerce_subscriptions_users_renewal_link',
'wcs_can_user_resubscribe_to_subscription' => 'woocommerce_can_subscription_be_renewed',
'wcs_renewal_order_created' => array(
'woocommerce_subscriptions_renewal_order_created', // Even though 'woocommerce_subscriptions_renewal_order_created' is an action, as it is attached to a filter, we need to handle it in here
'woocommerce_subscriptions_renewal_order_id',
),
// List Table Filters
'woocommerce_subscription_list_table_actions' => 'woocommerce_subscriptions_list_table_actions',
'woocommerce_subscription_list_table_column_status_content' => 'woocommerce_subscriptions_list_table_column_status_content',
'woocommerce_subscription_list_table_column_content' => 'woocommerce_subscriptions_list_table_column_content',
// User Filters
'wcs_can_user_put_subscription_on_hold' => 'woocommerce_subscriptions_can_current_user_suspend',
'wcs_view_subscription_actions' => 'woocommerce_my_account_my_subscriptions_actions',
'wcs_get_users_subscriptions' => 'woocommerce_users_subscriptions',
'wcs_users_change_status_link' => 'woocommerce_subscriptions_users_action_link',
'wcs_user_has_subscription' => 'woocommerce_user_has_subscription',
// Misc Filters
'woocommerce_subscription_max_failed_payments_exceeded' => 'woocommerce_subscriptions_max_failed_payments_exceeded',
'woocommerce_my_subscriptions_payment_method' => 'woocommerce_my_subscriptions_recurring_payment_method',
'woocommerce_subscriptions_update_payment_via_pay_shortcode' => 'woocommerce_subscriptions_update_recurring_payment_via_pay_shortcode',
'woocommerce_can_subscription_be_updated_to' => 'woocommerce_can_subscription_be_changed_to',
);
/**
* The following hooks are prefixes only, the are used a deprecated hooks. Refer to the source code for the suffix on these hooks.
*/
$deprecated_hook_prefixes = array(
'woocommerce_admin_changed_subscription_to_' => 'admin_changed_subscription_to_',
'woocommerce_scheduled_subscription_payment_' => 'scheduled_subscription_payment_',
'woocommerce_customer_changed_subscription_to_' => 'customer_changed_subscription_to_',
'woocommerce_subscription_payment_method_updated_to_' => 'woocommerce_subscriptions_updated_recurring_payment_method_to_',
'woocommerce_subscription_payment_method_updated_from_' => 'woocommerce_subscriptions_updated_recurring_payment_method_from_',
'woocommerce_subscription_failing_payment_method_updated_' => 'woocommerce_subscriptions_changed_failing_payment_method_',
// Gateway status change hooks
'woocommerce_subscription_activated_' => array(
'activated_subscription_',
'reactivated_subscription_',
),
'woocommerce_subscription_on-hold_' => 'subscription_put_on-hold_',
'woocommerce_subscription_cancelled_' => 'cancelled_subscription_',
'woocommerce_subscription_expired_' => 'subscription_expired_',
// This is a filter, not an action
'woocommerce_can_subscription_be_updated_to_' => 'woocommerce_subscription_can_be_changed_to_',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment