Skip to content

Commit

Permalink
Improve config set default args for shipping provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Nov 21, 2023
1 parent f8a9ad5 commit 0ea6ae3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1553,13 +1553,11 @@ public static function get_bulk_action_handlers() {
);

foreach ( $handlers as $key => $handler ) {

if ( is_object( $handler ) && is_a( $handler, 'Vendidero\Germanized\Shipments\Admin\BulkActionHandler' ) ) {
if ( is_a( $handler, 'Vendidero\Germanized\Shipments\Admin\BulkActionHandler' ) ) {
self::$bulk_handlers[ $key ] = $handler;
continue;
} else {
self::$bulk_handlers[ $key ] = new $handler();
}

self::$bulk_handlers[ $key ] = new $handler();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Labels/ConfigurationSetTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function get_configuration_set_default_args( $args ) {
$args = wp_parse_args(
$args,
array(
'shipping_provider_name' => '',
'shipping_provider_name' => is_a( $this, '\Vendidero\Germanized\Shipments\Interfaces\ShippingProvider' ) ? $this->get_name() : '',
'shipment_type' => 'simple',
'zone' => 'dom',
'setting_type' => $this->get_configuration_set_setting_type(),
Expand Down
2 changes: 1 addition & 1 deletion src/ShippingProvider/Auto.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public function update_setting( $setting, $value ) {
$setting_name_clean = $this->unprefix_setting_key( $setting );

if ( $this->is_configuration_set_setting( $setting_name_clean ) ) {
if ( $configuration_set = $this->get_configuration_set( $setting_name_clean ) ) {
if ( $configuration_set = $this->get_or_create_configuration_set( $setting_name_clean ) ) {
$configuration_set->update_setting( $setting_name_clean, $value );
$this->update_configuration_set( $configuration_set );
}
Expand Down

0 comments on commit 0ea6ae3

Please sign in to comment.