Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
WooCommerce cambia el valor de la casilla de verificación según el producto en el carrito

Usamos un complemento para las pasarelas de pago. Hay una configuración para suscripciones recurrentes. Ahora tenemos una suscripción donde necesitamos esa casilla de verificación seleccionada y tenemos un sub donde no necesitamos esa casilla de verificación recurrente.

Este es el código del complemento original:

 <input type="checkbox" checked name="payrexx-allow-recurring" id="payrexx-allow-recurring" value="1" />

Ahora, si la suscripción especial (verifique con ID) está en el carrito, desmarque la casilla de verificación y oculte la casilla de verificación. Si hay otro submarino en el carrito, no hagas nada.

¿Podemos hacer esto con PHP o aquí se necesita js? Soy un principiante, así que sería bueno que me dijeran cómo puedo hacer esto y cómo. :)

saludos y gracias

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

function conditional_checkout_fields_js( $fields ) { $cart = WC()->cart->get_cart(); foreach ( $cart as $item_key => $values ) { $product = $values['data']; if ( $product->get_id() == 1631817356 ) { // Change the product ID $html .= '<script type="text/javascript"> jQuery(function() { jQuery("#payrexx-allow-recurring").prop("checked", false); // Unchecks it jQuery("#payrexx-allow-recurring").hide(); }); </script>'; echo $html; } } return $fields; } add_filter( 'woocommerce_checkout_fields', 'conditional_checkout_fields_js' );

Agregue esto a su archivo de functions.php de tema secundario activo.php

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!