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

263
Views
Cómo editar el precio del producto en la página del carrito de Woocommerce

Estoy usando el complemento Woocommerce y quiero agregar una funcionalidad donde el cliente pueda editar el precio del producto en la página del carrito. Aquí está mi código

 add_filter( 'woocommerce_cart_item_price', 'set_price_in_cart', 999999, 3 ); function set_price_in_cart( $price, $cart_item, $cart_item_key ) { if (isset($cart_item['_tz_original_price'])){ $original_price = $cart_item['_tz_original_price']; } else { $original_price = $cart_item['data']->get_price(); } $min = $original_price; $attributes = apply_filters( 'salesking_cart_input', array( 'class' => 'input-text text', 'min' => $min, 'step' => '1', ) ); $field = sprintf( '<input type="number" name="cart[%s][_tz_edited_price]" value="%s" %s>', $cart_item_key, $cart_item['data']->get_price(), implode( '', array_map( function( $key, $value ) { return sprintf( ' %s="%s"', $key, $value ); }, array_keys( $attributes ), $attributes ) ) ); return $field; }

Con el código anterior logro el campo de entrada en la columna de precio.

Pero cuando el cliente edita el precio y hace clic en el botón Actualizar, entonces ocurre la observación. Alguien me puede ayudar y orientar por favor

about 4 years ago · Juan Pablo Isaza
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!