@@ -276,6 +276,12 @@ public function init_form_fields() {
276276 'description ' => __ ( 'Number of default instalments in product widget ' , 'aplazame ' ),
277277 'placeholder ' => __ ( 'Optional (only numbers) ' , 'aplazame ' ),
278278 ),
279+ 'product_downpayment_info ' => array (
280+ 'type ' => 'checkbox ' ,
281+ 'title ' => __ ( 'Downpayment info ' , 'aplazame ' ),
282+ 'description ' => __ ( 'Show downpayment info in product widget ' , 'aplazame ' ),
283+ 'label ' => __ ( 'Show downpayment info ' , 'aplazame ' ),
284+ ),
279285 'product_legal_advice ' => array (
280286 'type ' => 'checkbox ' ,
281287 'title ' => __ ( 'Legal notice ' , 'aplazame ' ),
@@ -369,6 +375,12 @@ public function init_form_fields() {
369375 'description ' => __ ( 'Number of default instalments in cart widget ' , 'aplazame ' ),
370376 'placeholder ' => __ ( 'Optional (only numbers) ' , 'aplazame ' ),
371377 ),
378+ 'cart_downpayment_info ' => array (
379+ 'type ' => 'checkbox ' ,
380+ 'title ' => __ ( 'Downpayment info ' , 'aplazame ' ),
381+ 'description ' => __ ( 'Show downpayment info in cart widget ' , 'aplazame ' ),
382+ 'label ' => __ ( 'Show downpayment info ' , 'aplazame ' ),
383+ ),
372384 'cart_legal_advice ' => array (
373385 'type ' => 'checkbox ' ,
374386 'title ' => __ ( 'Legal notice ' , 'aplazame ' ),
@@ -435,17 +447,18 @@ public function init_form_fields() {
435447 }
436448
437449 protected function validate_private_api_key_field ( $ key , $ value ) {
438- try {
439- $ response = WC_Aplazame::configure_aplazame_profile ( $ this ->settings ['sandbox ' ], $ value );
440- } catch ( Exception $ e ) {
441- // Workaround https://github.com/woocommerce/woocommerce/issues/11952
442- WC_Admin_Settings::add_error ( $ e ->getMessage () );
450+ if ( $ value != $ this ->settings ['private_api_key ' ] ) {
451+ try {
452+ $ response = WC_Aplazame::configure_aplazame_profile ( $ this ->settings ['sandbox ' ], $ value );
453+ } catch ( Exception $ e ) {
454+ // Workaround https://github.com/woocommerce/woocommerce/issues/11952
455+ WC_Admin_Settings::add_error ( $ e ->getMessage () );
456+
457+ throw $ e ;
458+ }
443459
444- throw $ e ;
460+ $ this -> settings [ ' public_api_key ' ] = $ response [ ' public_api_key ' ] ;
445461 }
446-
447- $ this ->settings ['public_api_key ' ] = $ response ['public_api_key ' ];
448-
449462 return $ value ;
450463 }
451464}
0 commit comments