Skip to content

Commit

Permalink
Woo explicitly casts multiselect option values to strings before comp…
Browse files Browse the repository at this point in the history
…aring - cast packaging shipping class ids to string.
  • Loading branch information
dennisnissle committed Feb 6, 2024
1 parent f6a51a4 commit d0dc50b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Admin/PackagingSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public static function is_provider( $tab ) {
* @return array
*/
public static function get_general_settings( $packaging, $section = '' ) {
var_dump( Package::get_shipping_classes() );
var_dump( $packaging->get_available_shipping_classes() );

return array(
array(
'title' => '',
Expand Down Expand Up @@ -157,7 +160,11 @@ public static function get_general_settings( $packaging, $section = '' ) {
'class' => 'wc-enhanced-select',
'default' => array(),
'options' => Package::get_shipping_classes(),
'value' => $packaging->get_available_shipping_classes( 'edit' ),
/**
* Woo explicitly casts option values to strings before comparing.
* @see \WC_Admin_Settings::output_fields()
*/
'value' => array_map( 'strval', $packaging->get_available_shipping_classes( 'edit' ) ),
'custom_attributes' => array(
'data-placeholder' => _x( 'All shipping classes', 'shipments', 'woocommerce-germanized-shipments' ),
),
Expand Down

0 comments on commit d0dc50b

Please sign in to comment.