diff --git a/changelog.md b/changelog.md index fa82bf2..3fcbaea 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +#### Version 3.8.0 +- Improvement : Additional Filters +- Issue : Minumum Installment Message + #### Version 3.7.9 - Improvement : Debug file anonymization - Improvement : Missing language values diff --git a/core/library/Moka_Init.php b/core/library/Moka_Init.php index 040ce72..fa41b73 100644 --- a/core/library/Moka_Init.php +++ b/core/library/Moka_Init.php @@ -247,8 +247,9 @@ public function renderMinInstallmentMessage($price) $productPrice = $product->get_price(); $options = get_option( 'woocommerce_mokapay_settings' ); - $isavaliable = data_get($options, 'installment_message', 'yes') === 'yes'; - $limitInstallment = data_get($options, 'limitInstallment'); + $isavaliable = data_get( $options, 'installment_message', 'yes' ) === 'yes'; + $isavaliable = apply_filters( 'mokapay_mininstallment_message_avaliable', $isavaliable, $product); + $limitInstallment = data_get( $options, 'limitInstallment', 12 ); $stock = $product->get_stock_status() == 'instock' ? true : false; if( @@ -257,12 +258,16 @@ public function renderMinInstallmentMessage($price) ) { $installments = get_option( 'woocommerce_mokapay-installments' ); - $maxInstallment = self::calculateMaxInstallment($options, $product->get_id()); - $minRate = data_get(end($installments), 'rates.'.$maxInstallment.'.value'); - $minRatePrice = self::calculateComission($limitInstallment, $minRate, $productPrice); - - $return .= ' -
'.self::moka_price($minRatePrice['unit_price']). ' ' .' \' '.__( 'With installments starting from', 'moka-woocommerce' ).' ...
'; + if($installments && !empty($installments)){ + $maxInstallment = self::calculateMaxInstallment($options, $product->get_id()); + $minRate = data_get(end($installments), 'rates.'.$maxInstallment.'.value'); + if($minRate){ + $minRatePrice = self::calculateComission($limitInstallment, $minRate, $productPrice); + + $return_html = apply_filters( 'mokapay_mininstallment_message', '
'.self::moka_price($minRatePrice['unit_price']). ' ' .' '.__( 'With installments starting from', 'moka-woocommerce' ).' ...
', self::moka_price($minRatePrice['unit_price']), $product ); + $return .= $return_html; + } + } } else { $return = $price; } diff --git a/index.php b/index.php index e9aa199..c4e1059 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: Moka Payment Gateway for WooCommerce * Plugin URI: https://github.com/optimisthub/moka-woocommerce * Description: Moka Payment gateway for woocommerce - * Version: 3.7.9 + * Version: 3.8.0 * Author: Optimist Hub * Author URI: https://optimisthub.com/?utm_source=moka-woocommerce&utm_campaign=moka-woocommerce&utm_content=plugins * Domain Path: /languages/ @@ -14,7 +14,7 @@ exit; } -define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.7.9' ); +define( 'OPTIMISTHUB_MOKA_PAY_VERSION', '3.8.0' ); define( 'OPTIMISTHUB_MOKA_BASENAME', plugin_basename( __FILE__ ) ); define( 'OPTIMISTHUB_MOKA_DIR', plugin_dir_path( __FILE__ ) ); define( 'OPTIMISTHUB_MOKA_URL', plugin_dir_url( __FILE__ ) ); diff --git a/readme.md b/readme.md index d10cb51..e6e4440 100644 --- a/readme.md +++ b/readme.md @@ -39,6 +39,10 @@ For sandbox usage : https://developer.moka.com/home.php?page=test-kartlari Version history : https://github.com/optimisthub/moka-woocommerce/wiki/Changelog +### Filters & Actions + +Filters & Actions : https://github.com/optimisthub/moka-woocommerce/wiki/Filters-&-Actions + ### Other integrations - Moka PHP Client : https://github.com/optimisthub/moka-php