Skip to content

Commit

Permalink
Remove exibição dos campos para assinatura Vindi quando o WCS está de…
Browse files Browse the repository at this point in the history
…sabilitado (#140)

* Exibe/Oulta campos do plano de assinatura Vindi de acordo com o status do Plugin WCS

* Versionamento
  • Loading branch information
laerte-guimaraes authored Jan 30, 2020
1 parent 51e6f41 commit 7948f09
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Notas das versões

## [5.5.3 - 30/01/2020](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.3)

### Corrigido
- Remove exibição dos campos para assinatura Vindi quando o Woocommerce Subscriptions não está habilitado


## [5.5.2 - 09/01/2020](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.2)

### Corrigido
- Corrige exibição de datas no plugin


## [5.5.1 - 04/06/2019](https://github.com/vindi/vindi-woocommerce-subscriptions/releases/tag/5.5.1)

### Ajustado
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Requires at least: 4.4
Tested up to: 5.2.1
WC requires at least: 3.0.0
WC tested up to: 3.6.4
Stable Tag: 5.5.2
Stable Tag: 5.5.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -27,6 +27,9 @@ Para dúvidas e suporte técnico, entre em contato com a equipe Vindi através d

== Changelog ==

= 5.5.3 - 30/01/2020 =
- Remove exibição dos campos para assinatura Vindi quando o Woocommerce Subscriptions não está habilitado

= 5.5.2 - 09/01/2020 =
- Corrige exibição de datas no plugin

Expand Down
30 changes: 21 additions & 9 deletions vindi-woocommerce-subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Vindi Woocommerce
* Plugin URI:
* Description: Adiciona o gateway de pagamentos da Vindi para o WooCommerce.
* Version: 5.5.2
* Version: 5.5.3
* Author: Vindi
* Author URI: https://www.vindi.com.br
* Requires at least: 4.4
Expand Down Expand Up @@ -39,7 +39,7 @@ class Vindi_WooCommerce_Subscriptions
/**
* @var string
*/
const VERSION = '5.5.2';
const VERSION = '5.5.3';

/**
* @var string
Expand Down Expand Up @@ -126,13 +126,7 @@ public function __construct()
&$this, 'add_admin_scripts'
));

add_action('woocommerce_product_options_general_product_data',
array(&$this, 'simple_subscription_custom_fields')
);

add_action('woocommerce_product_after_variable_attributes',
array(&$this, 'variable_subscription_custom_fields')
, 10, 3);
$this->set_vindi_subscription_fields();

add_action('woocommerce_process_product_meta',
array(&$this, 'save_subscription_meta')
Expand All @@ -151,6 +145,24 @@ public function __construct()
}
}

/**
* Enable/Disable Vindi subscription fields according to WCS
*/
public function set_vindi_subscription_fields()
{
if ($this->settings->dependency->wc_subscriptions_are_activated()) {
add_action('woocommerce_product_options_general_product_data',
array(&$this, 'simple_subscription_custom_fields'));
add_action('woocommerce_product_after_variable_attributes',
array(&$this, 'variable_subscription_custom_fields'), 10, 3);
} else {
remove_action('woocommerce_product_options_general_product_data',
array(&$this, 'simple_subscription_custom_fields'));
remove_action('woocommerce_product_after_variable_attributes',
array(&$this, 'variable_subscription_custom_fields'), 10, 3);
}
}

/**
* Set supported intervals number for subscription plans
*/
Expand Down

0 comments on commit 7948f09

Please sign in to comment.