mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Fix Pay later locations according to selected smart button locations
This commit is contained in:
parent
edfbf2308c
commit
416881da70
1 changed files with 19 additions and 1 deletions
|
@ -1283,6 +1283,24 @@ return array(
|
|||
$settings = $container->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
return $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array();
|
||||
$button_locations = $container->get( 'wcgateway.button.locations' );
|
||||
unset( $button_locations['mini-cart'] );
|
||||
|
||||
$smart_button_selected_locations = $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array();
|
||||
$pay_later_button_locations = array();
|
||||
|
||||
if ( empty( $smart_button_selected_locations ) ) {
|
||||
return $pay_later_button_locations;
|
||||
}
|
||||
|
||||
foreach ( $button_locations as $location_key => $location ) {
|
||||
if ( ! in_array( $location_key, $smart_button_selected_locations, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pay_later_button_locations[ $location_key ] = $location;
|
||||
}
|
||||
|
||||
return $pay_later_button_locations;
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue