Changeset 3448554
- Timestamp:
- 01/28/2026 10:02:31 AM (6 weeks ago)
- Location:
- woo-min-max-quantity-step-control-single
- Files:
-
- 201 added
- 4 edited
-
tags/8.0.1 (added)
-
tags/8.0.1/admin (added)
-
tags/8.0.1/admin/add_options_admin.php (added)
-
tags/8.0.1/admin/adm-inc (added)
-
tags/8.0.1/admin/adm-inc/plugin-installer.php (added)
-
tags/8.0.1/admin/adm-inc/settings (added)
-
tags/8.0.1/admin/adm-inc/settings/menu-control.php (added)
-
tags/8.0.1/admin/adm-inc/settings/settings-loader.php (added)
-
tags/8.0.1/admin/adm-inc/settings/wc-tab.php (added)
-
tags/8.0.1/admin/admin-loader.php (added)
-
tags/8.0.1/admin/functions.php (added)
-
tags/8.0.1/admin/includes (added)
-
tags/8.0.1/admin/includes/terms_condition.php (added)
-
tags/8.0.1/admin/page (added)
-
tags/8.0.1/admin/page-loader.php (added)
-
tags/8.0.1/admin/page/addons-list.php (added)
-
tags/8.0.1/admin/page/browse-plugins.php (added)
-
tags/8.0.1/admin/page/main-page (added)
-
tags/8.0.1/admin/page/main-page.php (added)
-
tags/8.0.1/admin/page/main-page/edit-terms.php (added)
-
tags/8.0.1/admin/page/main-page/live-support.php (added)
-
tags/8.0.1/admin/page/main-page/premium-placeholder.php (added)
-
tags/8.0.1/admin/page/main-page/supported-terms.php (added)
-
tags/8.0.1/admin/page/main-page/universal-settings.php (added)
-
tags/8.0.1/admin/page/product-quick-edit.php (added)
-
tags/8.0.1/admin/page/topbar.php (added)
-
tags/8.0.1/admin/plugin_setting_link.php (added)
-
tags/8.0.1/admin/product_panel.php (added)
-
tags/8.0.1/assets (added)
-
tags/8.0.1/assets/bakup (added)
-
tags/8.0.1/assets/bakup/cart-page-block-code.txt (added)
-
tags/8.0.1/assets/bakup/checkout-page-block-code.txt (added)
-
tags/8.0.1/assets/css (added)
-
tags/8.0.1/assets/css/admin-common.css (added)
-
tags/8.0.1/assets/css/admin.css (added)
-
tags/8.0.1/assets/css/customized-bootstap-code-backup.css (added)
-
tags/8.0.1/assets/css/message.css (added)
-
tags/8.0.1/assets/css/new-admin.css (added)
-
tags/8.0.1/assets/css/notice.css (added)
-
tags/8.0.1/assets/css/select2.css (added)
-
tags/8.0.1/assets/css/select2.min.css (added)
-
tags/8.0.1/assets/css/wcmmq-front.css (added)
-
tags/8.0.1/assets/fontello (added)
-
tags/8.0.1/assets/fontello/LICENSE.txt (added)
-
tags/8.0.1/assets/fontello/README.txt (added)
-
tags/8.0.1/assets/fontello/config.json (added)
-
tags/8.0.1/assets/fontello/css (added)
-
tags/8.0.1/assets/fontello/css/animation.css (added)
-
tags/8.0.1/assets/fontello/css/wcmmq-icon-codes.css (added)
-
tags/8.0.1/assets/fontello/css/wcmmq-icon-embedded.css (added)
-
tags/8.0.1/assets/fontello/css/wcmmq-icon-ie7-codes.css (added)
-
tags/8.0.1/assets/fontello/css/wcmmq-icon-ie7.css (added)
-
tags/8.0.1/assets/fontello/css/wcmmq-icon.css (added)
-
tags/8.0.1/assets/fontello/demo.html (added)
-
tags/8.0.1/assets/fontello/font (added)
-
tags/8.0.1/assets/fontello/font/wcmmq-icon.eot (added)
-
tags/8.0.1/assets/fontello/font/wcmmq-icon.svg (added)
-
tags/8.0.1/assets/fontello/font/wcmmq-icon.ttf (added)
-
tags/8.0.1/assets/fontello/font/wcmmq-icon.woff (added)
-
tags/8.0.1/assets/fontello/font/wcmmq-icon.woff2 (added)
-
tags/8.0.1/assets/images (added)
-
tags/8.0.1/assets/images/brand (added)
-
tags/8.0.1/assets/images/brand/animated-logo.gif (added)
-
tags/8.0.1/assets/images/brand/bg-black-logo-full.png (added)
-
tags/8.0.1/assets/images/brand/bg-black-logo.png (added)
-
tags/8.0.1/assets/images/brand/black-small-logo.png (added)
-
tags/8.0.1/assets/images/brand/header-logo-white-x.png (added)
-
tags/8.0.1/assets/images/brand/header-logo-white.png (added)
-
tags/8.0.1/assets/images/brand/header-logo.png (added)
-
tags/8.0.1/assets/images/brand/social (added)
-
tags/8.0.1/assets/images/brand/social/bizzmudra.png (added)
-
tags/8.0.1/assets/images/brand/social/bizzplugin.png (added)
-
tags/8.0.1/assets/images/brand/social/facebook.png (added)
-
tags/8.0.1/assets/images/brand/social/linkedin.png (added)
-
tags/8.0.1/assets/images/brand/social/min-max.png (added)
-
tags/8.0.1/assets/images/brand/social/skype.png (added)
-
tags/8.0.1/assets/images/brand/social/ticket.png (added)
-
tags/8.0.1/assets/images/brand/social/twitter.png (added)
-
tags/8.0.1/assets/images/brand/social/web.png (added)
-
tags/8.0.1/assets/images/brand/social/wpt.png (added)
-
tags/8.0.1/assets/images/brand/social/yelp.png (added)
-
tags/8.0.1/assets/images/brand/social/youtube.png (added)
-
tags/8.0.1/assets/images/copoun-min-max.png (added)
-
tags/8.0.1/assets/images/large-logo.png (added)
-
tags/8.0.1/assets/images/min-max-logo.png (added)
-
tags/8.0.1/assets/images/min-max.png (added)
-
tags/8.0.1/assets/images/money-back.png (added)
-
tags/8.0.1/assets/images/products (added)
-
tags/8.0.1/assets/images/products/ca-quick-view.png (added)
-
tags/8.0.1/assets/images/products/product-sync-master-sheet.png (added)
-
tags/8.0.1/assets/images/products/ultraaddons-elementor-lite.png (added)
-
tags/8.0.1/assets/images/products/wc-quantity-plus-minus-button.png (added)
-
tags/8.0.1/assets/images/products/woo-min-max-quantity-step-control-single.png (added)
-
tags/8.0.1/assets/images/products/woo-product-table.png (added)
-
tags/8.0.1/assets/js (added)
-
tags/8.0.1/assets/js/admin.js (added)
-
tags/8.0.1/assets/js/ajax-add-to-cart-backup.js (added)
-
tags/8.0.1/assets/js/ajax-add-to-cart.js (added)
-
tags/8.0.1/assets/js/custom-backup.js (added)
-
tags/8.0.1/assets/js/custom.js (added)
-
tags/8.0.1/assets/js/select2.full.js (added)
-
tags/8.0.1/assets/js/select2.full.min.js (added)
-
tags/8.0.1/assets/js/select2.js (added)
-
tags/8.0.1/autoloader.php (added)
-
tags/8.0.1/blueprint.json (added)
-
tags/8.0.1/core (added)
-
tags/8.0.1/core/base.php (added)
-
tags/8.0.1/framework (added)
-
tags/8.0.1/framework/ca-framework (added)
-
tags/8.0.1/framework/ca-framework/app (added)
-
tags/8.0.1/framework/ca-framework/app/base (added)
-
tags/8.0.1/framework/ca-framework/app/base/notice-base.php (added)
-
tags/8.0.1/framework/ca-framework/app/notice.php (added)
-
tags/8.0.1/framework/ca-framework/app/require-control.php (added)
-
tags/8.0.1/framework/ca-framework/assets (added)
-
tags/8.0.1/framework/ca-framework/assets/css (added)
-
tags/8.0.1/framework/ca-framework/assets/css/ca-notification.css (added)
-
tags/8.0.1/framework/ca-framework/assets/js (added)
-
tags/8.0.1/framework/ca-framework/assets/js/ajax-update.js (added)
-
tags/8.0.1/framework/ca-framework/example.php (added)
-
tags/8.0.1/framework/ca-framework/form (added)
-
tags/8.0.1/framework/ca-framework/form/fields (added)
-
tags/8.0.1/framework/ca-framework/form/fields/input.php (added)
-
tags/8.0.1/framework/ca-framework/form/fields/select.php (added)
-
tags/8.0.1/framework/ca-framework/form/fields/switch-control.php (added)
-
tags/8.0.1/framework/ca-framework/form/form-bk.php (added)
-
tags/8.0.1/framework/ca-framework/form/form.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc (added)
-
tags/8.0.1/framework/ca-framework/form/inc/control-settings.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc/field-base.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc/field.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc/form-base.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc/form-control.php (added)
-
tags/8.0.1/framework/ca-framework/form/inc/input-base.php (added)
-
tags/8.0.1/framework/ca-framework/form/root.php (added)
-
tags/8.0.1/framework/ca-framework/framework.php (added)
-
tags/8.0.1/framework/ca-framework/loader.php (added)
-
tags/8.0.1/framework/offr-manage.php (added)
-
tags/8.0.1/framework/plugin-required.php (added)
-
tags/8.0.1/framework/recommeded.php (added)
-
tags/8.0.1/includes (added)
-
tags/8.0.1/includes/enqueue.php (added)
-
tags/8.0.1/includes/feature-loader.php (added)
-
tags/8.0.1/includes/features (added)
-
tags/8.0.1/includes/features/quantiy-archive.php (added)
-
tags/8.0.1/includes/features/syncronize-google-sheet.php (added)
-
tags/8.0.1/includes/functions.php (added)
-
tags/8.0.1/includes/min-max-controller.php (added)
-
tags/8.0.1/includes/set_max_min_quantity.php (added)
-
tags/8.0.1/languages (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-bn_BD.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-bn_BD.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-da_DK.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-da_DK.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-de_DE.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-de_DE.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-de_DE_formal.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-de_DE_formal.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-en_GB.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-en_GB.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-en_US.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-en_US.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-es_ES.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-es_ES.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-fr_FR.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-fr_FR.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-hi_IN.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-hi_IN.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-hr.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-hr.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-id_ID.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-id_ID.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-it_IT.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-it_IT.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nb_NO.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nb_NO.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nl_BE.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nl_BE.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nl_NL.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-nl_NL.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-pl_PL.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-pl_PL.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-ru_RU.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-ru_RU.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-sk_SK.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-sk_SK.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-tr_TR.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-tr_TR.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-uk.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-uk.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-zh_CN.mo (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single-zh_CN.po (added)
-
tags/8.0.1/languages/woo-min-max-quantity-step-control-single.pot (added)
-
tags/8.0.1/modules (added)
-
tags/8.0.1/modules/module (added)
-
tags/8.0.1/modules/module-controller.php (added)
-
tags/8.0.1/modules/module-page.php (added)
-
tags/8.0.1/modules/module/guttenberg-block.php (added)
-
tags/8.0.1/modules/module/loop-template-button.php (added)
-
tags/8.0.1/readme.txt (added)
-
tags/8.0.1/wcmmq.php (added)
-
trunk/admin/functions.php (modified) (1 diff)
-
trunk/admin/page/main-page.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wcmmq.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-min-max-quantity-step-control-single/trunk/admin/functions.php
r3447561 r3448554 275 275 <?php 276 276 } 277 278 279 function wcmmq_form_submit(){ 280 $nonce = isset($_POST['nonce']) ? sanitize_text_field( wp_unslash($_POST['nonce']) ) : ''; 281 282 if ( empty($nonce) || ! wp_verify_nonce( $nonce, WC_MMQ_PLUGIN_BASE_FOLDER ) ) { 283 return; 284 } 285 286 /** 287 * RESET 288 */ 289 if ( isset($_POST['reset_button']) ) { 290 291 update_option( WC_MMQ_KEY, WC_MMQ::getDefaults() ); 292 echo '<div class="updated notice"><p>Settings reset successfully.</p></div>'; 293 return; 294 } 295 296 /** 297 * SAVE 298 */ 299 if ( ! isset($_POST['configure_submit'], $_POST['data']) ) { 300 return; 301 } 302 303 $data = wp_unslash( $_POST['data'] ); 304 305 /** 306 * Keys 307 */ 308 $min_key = WC_MMQ_PREFIX . 'min_quantity'; 309 $max_key = WC_MMQ_PREFIX . 'max_quantity'; 310 $step_key = WC_MMQ_PREFIX . 'product_step'; 311 $default_key = WC_MMQ_PREFIX . 'default_quantity'; 312 $pm_key = WC_MMQ_PREFIX . 'qty_plus_minus_btn'; 313 314 /** 315 * Sanitize (decimal supported) 316 */ 317 $min = isset($data[$min_key]) ? floatval($data[$min_key]) : 0; 318 $step = isset($data[$step_key]) ? floatval($data[$step_key]) : 1; 319 $max_raw = isset($data[$max_key]) ? trim($data[$max_key]) : ''; 320 $default = isset($data[$default_key]) ? floatval($data[$default_key]) : 0; 321 322 /** 323 * STEP validation (must not be zero) 324 */ 325 if ( $step <= 0 ) { 326 $step = 1; 327 echo '<div class="error notice"><p>Step quantity can not be zero. Reset to 1.</p></div>'; 328 } 329 330 /** 331 * MAX validation 332 * empty = unlimited 333 * zero NOT allowed 334 */ 335 $max = ''; 336 337 if ( $max_raw !== '' ) { 338 339 $max = floatval($max_raw); 340 341 if ( $max == 0 ) { 342 $max = ''; 343 echo '<div class="error notice"><p>Maximum quantity can not be zero. Treated as unlimited.</p></div>'; 344 } 345 } 346 347 /** 348 * Min / Max relation 349 */ 350 if ( $max !== '' && $max <= $min ) { 351 $max = $min + $step; 352 echo '<div class="error notice"><p>Maximum quantity must be greater than minimum. It has been adjusted automatically.</p></div>'; 353 } 354 355 /** 356 * Default quantity validation 357 */ 358 if ( $default < $min ) { 359 $default = $min; 360 echo '<div class="error notice"><p>Default quantity was lower than minimum. Reset to minimum.</p></div>'; 361 } 362 363 if ( $max !== '' && $default > $max ) { 364 $default = $min; 365 echo '<div class="error notice"><p>Default quantity exceeded maximum. Reset to minimum.</p></div>'; 366 } 367 368 /** 369 * Checkbox normalize 370 */ 371 $pm_btn = isset( $data[$pm_key] ) ? 1 : 0; 372 373 /** 374 * Final data 375 */ 376 377 $data[$min_key] = $min; 378 $data[$step_key] = $step; 379 $data[$max_key] = $max; 380 $data[$default_key] = $default; 381 $data[$pm_key] = $pm_btn; 382 383 if( ! defined( 'WC_MMQ_PRO_VERSION' ) ){ 384 //min max step will be int, no decimal 385 $data[$min_key] = ! empty( $min ) ? intval( $min ) : $min; 386 $data[$step_key] = ! empty( $step ) ? intval( $step ) : $step; 387 $data[$max_key] = ! empty( $max ) ? intval( $max ) : $max; 388 $data[$default_key] = ! empty( $default ) ? intval( $default ) : $default; 389 390 } 391 392 393 $final_data = apply_filters( 'wcmmq_before_save_settings', $data ); 394 395 update_option( WC_MMQ_KEY, $data ); 396 return $final_data; 397 echo '<div class="updated notice"><p>Settings saved successfully.</p></div>'; 398 399 } -
woo-min-max-quantity-step-control-single/trunk/admin/page/main-page.php
r3409281 r3448554 4 4 5 5 $saved_data = WC_MMQ::getOptions(); 6 $nonce = sanitize_text_field( wp_unslash( $_POST['nonce'] ?? '' ) );7 if ( ! empty($nonce) && wp_verify_nonce( $nonce, WC_MMQ_PLUGIN_BASE_FOLDER ) ) {8 9 if( isset( $_POST['reset_button'] ) ){10 $data = WC_MMQ::getDefaults();11 update_option( WC_MMQ_KEY, $data );12 ?><div class="updated"><p>Reset Successfully</p></div><?php13 }elseif( isset( $_POST['configure_submit'] ) && filter_input_array(INPUT_POST) ){14 $full_data = filter_input_array( INPUT_POST );15 $data = $full_data['data'] ?? array();16 6 17 $_min_quantity_name = WC_MMQ_PREFIX . 'min_quantity'; 18 $_max_quantity_name = WC_MMQ_PREFIX . 'max_quantity'; 19 $_product_step_name = WC_MMQ_PREFIX . 'product_step'; 20 $_default_quantity_name = WC_MMQ_PREFIX . 'default_quantity'; 21 $_qty_plus_minus_btn_name = WC_MMQ_PREFIX . 'qty_plus_minus_btn'; 7 if( ! empty( $_POST ) && ( isset( $_POST['configure_submit'] ) || isset( $_POST['reset_button'] ) ) ){ 8 $submit_form = wcmmq_form_submit(); 9 if( is_array( $submit_form ) && ! empty( $submit_form ) ){ 10 $saved_data = $submit_form; 11 } 12 13 } 22 14 23 15 24 $min_quantity_set = !empty($data[$_min_quantity_name]);25 $min_quantity_not_zero = $data[$_min_quantity_name] != 0;26 $min_quantity_not_one = $data[$_min_quantity_name] != 1;27 $max_quantity_less_or_equal_min = $data[WC_MMQ_PREFIX . 'max_quantity'] <= $data[$_min_quantity_name];28 if ($min_quantity_set && $min_quantity_not_zero && $min_quantity_not_one && $max_quantity_less_or_equal_min) {29 $data[$_max_quantity_name] = $data[$_min_quantity_name] + 5;30 echo '<div class="error notice"><p>Maximum Quantity can not be smaller, So we have added 5</p></div>';31 }32 if( !$data[$_product_step_name] || $data[$_product_step_name] == '0' || $data[$_product_step_name] == 0 ){33 $data[$_product_step_name] = 1;34 }35 36 if( !$data[$_min_quantity_name] || $data[$_min_quantity_name] == '0' || $data[$_min_quantity_name] == 0 ){37 $data[$_min_quantity_name] = '0';38 }39 $data[$_default_quantity_name] = isset( $data[$_default_quantity_name] ) && $data[$_default_quantity_name] >= $data[$_min_quantity_name] && ( empty( $data[$_max_quantity_name] ) || $data[$_default_quantity_name] <= $data[$_max_quantity_name] ) ? $data[$_default_quantity_name] : false;40 41 //plus minus checkbox data fixer42 $data[ $_qty_plus_minus_btn_name ] = !isset( $data[ $_qty_plus_minus_btn_name ] ) ? 0 : 1;43 44 $data = apply_filters( 'wcmmq_before_save_settings', $data );45 $saved_data = $data;46 update_option( WC_MMQ_KEY, $data);47 ?><div class="updated"><p>Successfully Updated</p></div><?php48 }49 }50 16 51 17 -
woo-min-max-quantity-step-control-single/trunk/readme.txt
r3447561 r3448554 6 6 Tested up to: 6.9 7 7 Requires PHP: 5.4 8 Stable tag: 8.0. 08 Stable tag: 8.0.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 257 257 == Changelog == 258 258 259 = 8.0.1 = 260 * Fixed: Min max step setting saving issue has been fixed. 261 * Fixed: Textdomain loading issue has been fixed. 262 * Bug Fixed. 263 259 264 = 8.0.0 = 260 265 * Vendor library removed. -
woo-min-max-quantity-step-control-single/trunk/wcmmq.php
r3447561 r3448554 9 9 * Tags: WooCommerce, minimum quantity, maximum quantity, woocommrce quantity, input step control for WC, customize wc quantity, wc qt, max qt, min qt, maximum qt, minimum qt 10 10 * 11 * Version: 8.0. 011 * Version: 8.0.1 12 12 * Requires at least: 4.0.0 13 13 * Tested up to: 6.9 … … 31 31 32 32 define('WC_MMQ__FILE__', __FILE__); 33 define('WC_MMQ_VERSION', '8.0. 0.0');33 define('WC_MMQ_VERSION', '8.0.1.0'); 34 34 define('WC_MMQ_PATH', plugin_dir_path(WC_MMQ__FILE__)); 35 35 define('WC_MMQ_URL', plugins_url(DIRECTORY_SEPARATOR, WC_MMQ__FILE__)); … … 291 291 //check current value 292 292 $current_value = get_option(WC_MMQ_KEY); 293 $default_value = self::$default_values; 294 $changed_value = []; 295 //Set default value in Options 296 if ($current_value) { 297 foreach ($default_value as $key => $value) { 298 if (isset($current_value[$key]) && $key != 'plugin_version') { //We will add Plugin version in future 299 $changed_value[$key] = $current_value[$key]; 300 } else { 301 $changed_value[$key] = $value; 302 } 303 } 304 update_option(WC_MMQ_KEY, $changed_value); 305 } else { 306 update_option(WC_MMQ_KEY, $default_value); 293 if ( empty( $current_value ) ) { 294 update_option(WC_MMQ_KEY, self::$default_values); 307 295 } 308 296 }
Note: See TracChangeset
for help on using the changeset viewer.