Support the cart block location for Google Pay

This commit is contained in:
Narek Zakarian 2025-02-07 12:59:00 +04:00
parent d32b10801d
commit a6cb606871
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -110,6 +110,7 @@ class StylingSettingsMapHelper {
return array(
'product' => 'product',
'cart' => 'cart',
'cart-block' => 'cart',
'checkout' => 'classic_checkout',
'mini-cart' => 'mini_cart',
'checkout-block-express' => 'express_checkout',
@ -178,6 +179,9 @@ class StylingSettingsMapHelper {
}
$enabled_locations[] = $locations[ $model->location ] ?? '';
if ( $model->location === 'cart' ) {
$enabled_locations[] = 'cart';
}
}
return $enabled_locations;
@ -198,6 +202,9 @@ class StylingSettingsMapHelper {
}
$enabled_locations[] = $locations[ $model->location ] ?? '';
if ( $model->location === 'cart' ) {
$enabled_locations[] = 'cart';
}
}
return $enabled_locations;
@ -234,7 +241,7 @@ class StylingSettingsMapHelper {
* @return int The enabled (1) or disabled (0) state.
* @throws RuntimeException If an invalid button name is provided.
*/
protected function mapped_google_pay_or_apple_pay_enabled_value( array $styling_models, string $button_name ): int {
protected function mapped_google_pay_or_apple_pay_enabled_value( array $styling_models, string $button_name ): ?int {
if ( $button_name !== 'googlepay' && $button_name !== 'applepay' ) {
throw new RuntimeException( 'Wrong button name is provided. Either "googlepay" or "applepay" can be used' );
}