Changeset 2569074
- Timestamp:
- 07/21/2021 10:12:12 AM (5 years ago)
- Location:
- fast-woo-tags/trunk
- Files:
-
- 2 edited
-
fast-woo-tags.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
fast-woo-tags/trunk/fast-woo-tags.php
r2359873 r2569074 4 4 * Plugin URI: https://www.fastflow.io/products/fast-woo-tag 5 5 * Description: Woocommerce addon for Fast Flow Tags 6 * Version: 1. 1.26 * Version: 1.2 7 7 * Author: FastFlow 8 8 * Author URI: https://www.fastflow.io … … 25 25 add_action( 'admin_footer', array($this, 'fast_woo_tag_product_script')); 26 26 add_action( 'woocommerce_new_order', array($this, 'fast_woo_tag_new_order'), 99, 1); 27 add_action( 'woocommerce_subscription_payment_failed', array($this, 'fast_woo_tag_sub_payment_failed'), 99, 2); 28 add_action( 'woocommerce_subscription_status_cancelled', array($this, 'fast_woo_tag_sub_payment_status_actions'), 99, 1); 29 add_action( 'woocommerce_subscription_status_expired', array($this, 'fast_woo_tag_sub_payment_status_actions'), 99, 1); 30 add_action( 'woocommerce_subscription_status_on-hold', array($this, 'fast_woo_tag_sub_payment_status_actions'), 99, 1); 27 31 } 28 32 … … 161 165 if (!in_array( $new_tag->term_id, array_column($fast_tags, 'term_id') ) ){ 162 166 wp_set_object_terms($user_id, (int)$new_tag->term_id, 'fast_tag', true); 167 do_action('after_tag_applied_hook',(int)$new_tag->term_id, $user_id); 163 168 } 169 } 170 171 public function fast_woo_tag_sub_payment_failed($subscription, $new_status){ 172 $order_id = $subscription->get_parent_id(); 173 $order = wc_get_order( $order_id ); 174 $user_id = $order->get_user_id(); 175 $new_tag = get_term_by('slug', 'wc-'.$new_status, 'fast_tag' ); 176 $fast_tags = wp_get_object_terms($user_id, 'fast_tag'); 177 if (!in_array( $new_tag->term_id, array_column($fast_tags, 'term_id') ) ){ 178 wp_set_object_terms($user_id, (int)$new_tag->term_id, 'fast_tag', true); 179 do_action('after_tag_applied_hook',(int)$new_tag->term_id, $user_id); 180 } 181 update_user_meta($order->get_user_id(), 'fwc_total_credit_amount', 0); 182 } 183 184 public function fast_woo_tag_sub_payment_status_actions($subscription){ 185 $order_id = $subscription->get_parent_id(); 186 $order = wc_get_order( $order_id ); 187 $user_id = $order->get_user_id(); 188 $new_tag = get_term_by('slug', 'wc-'.$order->get_status(), 'fast_tag' ); 189 $fast_tags = wp_get_object_terms($user_id, 'fast_tag'); 190 if (!in_array( $new_tag->term_id, array_column($fast_tags, 'term_id') ) ){ 191 wp_set_object_terms($user_id, (int)$new_tag->term_id, 'fast_tag', true); 192 do_action('after_tag_applied_hook',(int)$new_tag->term_id, $user_id); 193 } 194 update_user_meta($order->get_user_id(), 'fwc_total_credit_amount', 0); 164 195 } 165 196 -
fast-woo-tags/trunk/readme.txt
r2537632 r2569074 60 60 == Changelog == 61 61 62 = 1.2 = 63 64 Added hooks for WC Subscription plugin failed subscriptions status 65 66 woocommerce_subscription_status_cancelled 67 woocommerce_subscription_status_expired 68 woocommerce_subscription_status_on-hold 69 62 70 = 1.1.2 = 63 71
Note: See TracChangeset
for help on using the changeset viewer.