mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Do not register block when not supported country
This commit is contained in:
parent
c83975f293
commit
2e0845cbd4
1 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||||
namespace WooCommerce\PayPalCommerce\PayLaterBlock;
|
namespace WooCommerce\PayPalCommerce\PayLaterBlock;
|
||||||
|
|
||||||
use WooCommerce\PayPalCommerce\Button\Endpoint\CartScriptParamsEndpoint;
|
use WooCommerce\PayPalCommerce\Button\Endpoint\CartScriptParamsEndpoint;
|
||||||
|
use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||||
|
@ -44,6 +45,13 @@ class PayLaterBlockModule implements ModuleInterface {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function run( ContainerInterface $c ): void {
|
public function run( ContainerInterface $c ): void {
|
||||||
|
$messages_apply = $c->get( 'button.helper.messages-apply' );
|
||||||
|
assert( $messages_apply instanceof MessagesApply );
|
||||||
|
|
||||||
|
if ( ! $messages_apply->for_country() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
'init',
|
'init',
|
||||||
function () use ( $c ): void {
|
function () use ( $c ): void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue