Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not display the separator on minicart if button should be hidden #216

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions includes/class-wc-gateway-amazon-payments-advanced-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,4 +1148,16 @@ protected function is_product_button_enabled() {
protected function using_woo_blocks() {
return ! empty( $this->settings['using_woo_blocks'] ) && 'yes' === $this->settings['using_woo_blocks'];
}

/**
* Return if the hide button mode is enabled.
*
* @return boolean
*/
protected function is_hide_button_mode_enabled() {
$hide_button_mode_enabled = 'yes' === $this->settings['hide_button_mode'];
$hide_button_mode_enabled = apply_filters( 'woocommerce_amazon_payments_hide_amazon_buttons', $hide_button_mode_enabled );

return $hide_button_mode_enabled;
}
}
7 changes: 2 additions & 5 deletions includes/class-wc-gateway-amazon-payments-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ public function checkout_init( $checkout ) {
* @return void
*/
public function maybe_separator_and_checkout_button() {
if ( $this->is_available() && $this->possible_subscription_cart_supported() && $this->is_mini_cart_button_enabled() && WC()->cart->get_cart_contents_count() > 0 ) {
if ( $this->is_available() && $this->possible_subscription_cart_supported() && $this->is_mini_cart_button_enabled() && ! $this->is_hide_button_mode_enabled() && WC()->cart->get_cart_contents_count() > 0 ) {
?>
<div class="woocommerce-mini-cart__buttons buttons">
<?php
Expand Down Expand Up @@ -2420,10 +2420,7 @@ public function release_lock_for_order( $order ) {
* @since 1.6.0
*/
public function maybe_hide_amazon_buttons() {
$hide_button_mode_enabled = 'yes' === $this->settings['hide_button_mode'];
$hide_button_mode_enabled = apply_filters( 'woocommerce_amazon_payments_hide_amazon_buttons', $hide_button_mode_enabled );

if ( ! $hide_button_mode_enabled ) {
if ( ! $this->is_hide_button_mode_enabled() ) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1623,10 +1623,7 @@ public function maybe_hide_standard_checkout_button() {
* @since 1.6.0
*/
public function maybe_hide_amazon_buttons() {
$hide_button_mode_enabled = ( 'yes' === $this->settings['enabled'] && 'yes' === $this->settings['hide_button_mode'] );
$hide_button_mode_enabled = apply_filters( 'woocommerce_amazon_payments_hide_amazon_buttons', $hide_button_mode_enabled );

if ( ! $hide_button_mode_enabled ) {
if ( ! $this->is_hide_button_mode_enabled() ) {
return;
}

Expand Down
Loading