Skip to content

Commit

Permalink
Oculta metadados (type, vindi_id e price) no frontend (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
soareseneves authored and laerte-guimaraes committed Jun 11, 2019
1 parent 2123811 commit 4776550
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Notas das versões

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

### Ajustado
- Oculta metadados (type, vindi_id e price) do frontend


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

### Adicionado
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.0
Stable Tag: 5.5.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -63,6 +63,9 @@ Caso necessite de informações sobre a plataforma ou API por favor siga atravé

== Changelog ==

= 5.5.1 - 11/06/2019 =
- Oculta metadados (type, vindi_id e price) do frontend

= 5.5.0 - 04/06/2019 =
- Adiciona plano da Vindi para assinaturas do tipo variável

Expand Down
24 changes: 22 additions & 2 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.0
* Version: 5.5.1
* 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.0';
const VERSION = '5.5.1';

/**
* @var string
Expand Down Expand Up @@ -145,6 +145,9 @@ public function __construct()
add_action('woocommerce_save_product_variation',
array(&$this, 'save_subscription_variation_meta')
, 20, 2);
} else {
add_filter( 'woocommerce_order_item_get_formatted_meta_data',
array( &$this, 'hide_item_meta_data'), 10, 1 );
}
}

Expand Down Expand Up @@ -469,6 +472,23 @@ public function add_support_to_tlsv1_2($ch)

curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
}

/**
* @param array $formatted_meta
**/
function hide_item_meta_data($formatted_meta){
$temp_metas = [];
foreach($formatted_meta as $key => $meta) {
if ( isset( $meta->key ) && ! in_array( $meta->key, [
'type',
'vindi_id',
'price'
] ) ) {
$temp_metas[ $key ] = $meta;
}
}
return $temp_metas;
}
}
}

Expand Down

0 comments on commit 4776550

Please sign in to comment.