mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add ButtonModuleWatcher
Adjustments for APM support
This commit is contained in:
parent
e7e5ebde4e
commit
93afeeba68
6 changed files with 59 additions and 14 deletions
|
@ -480,11 +480,10 @@ class SmartButton implements SmartButtonInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<p
|
||||
id="ppc-button-minicart"
|
||||
class="woocommerce-mini-cart__buttons buttons"
|
||||
></p>';
|
||||
echo '<p class="woocommerce-mini-cart__buttons buttons">';
|
||||
echo '<span id="ppc-button-minicart"></span>';
|
||||
do_action( 'woocommerce_paypal_payments_minicart_button_render' );
|
||||
echo '</div>';
|
||||
},
|
||||
30
|
||||
);
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Button\Endpoint;
|
|||
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Money;
|
||||
use WooCommerce\PayPalCommerce\Button\Assets\SmartButton;
|
||||
|
||||
/**
|
||||
|
@ -100,18 +101,25 @@ class SimulateCartEndpoint extends AbstractCartEndpoint {
|
|||
$button_enabled = $button_enabled && ! $this->smart_button->is_button_disabled( 'product', $context_data );
|
||||
}
|
||||
|
||||
$base_location = wc_get_base_location();
|
||||
$shop_country_code = $base_location['country'];
|
||||
$currency_code = get_woocommerce_currency();
|
||||
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'total' => $total,
|
||||
'funding' => array(
|
||||
'total' => $total,
|
||||
'total_str' => ( new Money( $total, $currency_code ) )->value_str(),
|
||||
'currency_code' => $currency_code,
|
||||
'country_code' => $shop_country_code,
|
||||
'funding' => array(
|
||||
'paylater' => array(
|
||||
'enabled' => $pay_later_enabled,
|
||||
),
|
||||
),
|
||||
'button' => array(
|
||||
'button' => array(
|
||||
'is_disabled' => ! $button_enabled,
|
||||
),
|
||||
'messages' => array(
|
||||
'messages' => array(
|
||||
'is_hidden' => ! $pay_later_messaging_enabled,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue