Changeset 1833221
- Timestamp:
- 03/04/2018 03:53:21 PM (8 years ago)
- Location:
- minimum-order-amount-for-woocommerce/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
dc-moafw.php (modified) (2 diffs)
-
public/class-dc-moafw-public.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
minimum-order-amount-for-woocommerce/trunk/README.txt
r1796307 r1833221 5 5 Tags: woocommerce, order, woocommerce order, minimum order, woocommerce minimum order, shop, cart, woocommerce cart, product, products, minimum order amount, amount, minimum amount 6 6 Requires at least: 3.0.1 7 Tested up to: 4.9. 18 Stable tag: 1. 3.17 Tested up to: 4.9.4 8 Stable tag: 1.4.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 52 52 == Changelog == 53 53 54 = 1.4.0 - 04/03/18 = 55 * Fix - Now if the cart is empty, the minimum order notification is not shown 56 * New - Now the decimal and thousands separators are displayed as woocommerce settings 57 * New - Now the number of decimals in the price is the same as the woocommerce settings 58 * New - Now the currency position in the price is set as in the woocommerce settings 59 54 60 = 1.3.1 - 03/01/18 = 55 61 * Fix - Fix the fatal error on the cart page (if WCPBC_Customer class does not exist) -
minimum-order-amount-for-woocommerce/trunk/dc-moafw.php
r1796027 r1833221 10 10 * 11 11 * @link https://github.com/dcurasi 12 * @since 1. 3.112 * @since 1.4.0 13 13 * @package Dc_Moafw 14 14 * … … 17 17 * Plugin URI: https://github.com/dcurasi/dc-moafw 18 18 * Description: Minimum Order Amount for Woocommerce allows you to set easily and fast a minimum amount for the woocommerce orders. 19 * Version: 1. 3.119 * Version: 1.4.0 20 20 * Author: Dario Curasì 21 21 * Author URI: https://github.com/dcurasi -
minimum-order-amount-for-woocommerce/trunk/public/class-dc-moafw-public.php
r1796027 r1833221 118 118 $message = $this->dc_moafw_get_message(); 119 119 $current_cart_text = $this->dc_moafw_get_current_cart_text(); 120 $decimal_separator = wc_get_price_decimal_separator(); 121 $thousand_separator = wc_get_price_thousand_separator(); 122 $num_decimals = wc_get_price_decimals(); 120 123 121 124 // Total we are going to be using for the Math 122 125 // This is before taxes and shipping charges 123 $total = round(WC()->cart->subtotal, 2);126 $total = round(WC()->cart->subtotal, $num_decimals); 124 127 //print_r(WC()->cart->subtotal_ex_tax); 125 if( is_cart() || is_checkout()) {128 if( (is_cart() || is_checkout()) && $total) { 126 129 if($wcpbc_currency_active) { 127 130 // Set minimum cart total … … 132 135 wc_add_notice( sprintf( '<strong>'.$message.'</strong>' 133 136 .'<br />'.$current_cart_text, 134 number_format($minimum_cart_total, 2, ',', '.'),135 $this->dc_moafw_get_currency_display_type($wcpbc_values),136 number_format($total, 2, ',', '.'),137 $this->dc_moafw_get_currency_display_type($wcpbc_values) ),137 $this->dc_moafw_get_currency_display_type($wcpbc_values), 138 number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator), 139 $this->dc_moafw_get_currency_display_type($wcpbc_values), 140 number_format($total, $num_decimals, $decimal_separator, $thousand_separator) ), 138 141 'error' ); 139 142 } … … 147 150 wc_add_notice( sprintf( '<strong>'.$message.'</strong>' 148 151 .'<br />'.$current_cart_text, 149 number_format($minimum_cart_total, 2, ',', '.'),150 $this->dc_moafw_get_currency_display_type($wcpbc_values),151 number_format($total, 2, ',', '.'),152 $this->dc_moafw_get_currency_display_type($wcpbc_values) ),152 $this->dc_moafw_get_currency_display_type($wcpbc_values), 153 number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator), 154 $this->dc_moafw_get_currency_display_type($wcpbc_values), 155 number_format($total, $num_decimals, $decimal_separator, $thousand_separator) ), 153 156 'error' ); 154 157 } … … 163 166 // Display our error message 164 167 wc_add_notice( sprintf( '<strong>'.$message.'</strong>', 165 number_format($minimum_cart_total, 2, ',', '.'),166 $this->dc_moafw_get_currency_display_type($wcpbc_values)),168 $this->dc_moafw_get_currency_display_type($wcpbc_values), 169 number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator) ), 167 170 'error' ); 168 171 } … … 175 178 // Display our error message 176 179 wc_add_notice( sprintf( '<strong>'.$message.'</strong>', 177 number_format($minimum_cart_total, 2, ',', '.'),178 $this->dc_moafw_get_currency_display_type($wcpbc_values) ),180 $this->dc_moafw_get_currency_display_type($wcpbc_values), 181 number_format($minimum_cart_total, $num_decimals, $decimal_separator, $thousand_separator) ), 179 182 'error' ); 180 183 } … … 223 226 */ 224 227 public function dc_moafw_get_message() { 228 $price_format = get_woocommerce_price_format(); 225 229 if ( in_array( 'polylang/polylang.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('pll__') ) { 226 return str_replace('[minimum]', '%s %s', pll__(get_option('dc_moafw_message')));227 228 } 229 230 return str_replace('[minimum]', '%s %s', get_option('dc_moafw_message'));230 return str_replace('[minimum]', $price_format, pll__(get_option('dc_moafw_message'))); 231 232 } 233 234 return str_replace('[minimum]', $price_format, get_option('dc_moafw_message')); 231 235 } 232 236 … … 237 241 */ 238 242 public function dc_moafw_get_current_cart_text() { 243 $price_format = str_replace(array('1', '2'), array('3', '4'), get_woocommerce_price_format()); 239 244 if ( in_array( 'polylang/polylang.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && function_exists('pll__') ) { 240 return str_replace('[current]', '%s %s', pll__(get_option('dc_moafw_current_total_text')));241 } 242 return str_replace('[current]', '%s %s', get_option('dc_moafw_current_total_text'));245 return str_replace('[current]', $price_format, pll__(get_option('dc_moafw_current_total_text'))); 246 } 247 return str_replace('[current]', $price_format, get_option('dc_moafw_current_total_text')); 243 248 } 244 249
Note: See TracChangeset
for help on using the changeset viewer.