Skip to content

Commit

Permalink
Fix wrong class param usage when registering legacy fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Apr 23, 2024
1 parent 4f4fece commit c334126
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions assets/js/static/pickup-locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ window.germanized.shipments_pickup_locations = window.germanized.shipments_picku
var self = germanized.shipments_pickup_locations;
self.params = wc_gzd_shipments_pickup_locations_params;

var $pickupSelect = $( '#pickup_location' );
var $pickupSelect = self.getPickupLocationSelect();

if ( $pickupSelect.length > 0 ) {
self.pickupLocations = $pickupSelect.length > 0 ? $pickupSelect.data( 'locations' ) : {};
self.pickupLocations = $pickupSelect.data( 'locations' );

$( document.body ).on( 'updated_checkout', self.afterRefreshCheckout );
$( document ).on( 'change', '#pickup_location_field #pickup_location', self.onSelectPickupLocation );
Expand Down
10 changes: 5 additions & 5 deletions src/PickupDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function register_pickup_location_customer_number_field( $field, $
'current_location' => null,
'required' => false,
'hidden' => true,
'classes' => array(),
'class' => array(),
)
);

Expand All @@ -95,7 +95,7 @@ public static function register_pickup_location_customer_number_field( $field, $
$args['return'] = true;

if ( $args['hidden'] ) {
$args['classes'][] = 'hidden';
$args['class'][] = 'hidden';
}

$field = woocommerce_form_field( $key, $args, $value );
Expand All @@ -114,7 +114,7 @@ public static function register_pickup_location_field( $field, $key, $args, $val
'required' => false,
'custom_attributes' => array(),
'hidden' => true,
'classes' => array(),
'class' => array(),
)
);

Expand All @@ -133,12 +133,12 @@ public static function register_pickup_location_field( $field, $key, $args, $val

$args['custom_attributes']['data-locations'] = wp_json_encode( $args['custom_attributes']['data-locations'] );

if ( ! empty( $args['options'] ) ) {
if ( count( $args['options'] ) > 1 ) {
$args['hidden'] = false;
}

if ( $args['hidden'] ) {
$args['classes'][] = 'hidden';
$args['class'][] = 'hidden';
}

$field = woocommerce_form_field( $key, $args, $value );
Expand Down

0 comments on commit c334126

Please sign in to comment.