Avoid double input field
When geolocalization is active and a form uses the GET method, the script adds an hidden field for the geolocalization hash v, without checking if it already exists. But wc_query_string_form_fields adds it already, if the parameter was present in the called url.
This commit is contained in:
parent
09891e00cf
commit
3b18ac12d1
|
@ -56,8 +56,9 @@ jQuery( function( $ ) {
|
|||
$( 'form' ).each( function() {
|
||||
var $this = $( this );
|
||||
var method = $this.attr( 'method' );
|
||||
var hasField = $this.find('input[name="v"]').length > 0;
|
||||
|
||||
if ( method && 'get' === method.toLowerCase() ) {
|
||||
if ( method && 'get' === method.toLowerCase() && !hasField ) {
|
||||
$this.append( '<input type="hidden" name="v" value="' + wc_geolocation_params.hash + '" />' );
|
||||
} else {
|
||||
var href = $this.attr( 'action' );
|
||||
|
|
Loading…
Reference in New Issue