PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
← All changes | src/Gateway/Blocks/PayplugGenericBlock.php +7 -2 2.18.0 → 3.1.0 View file →
@@ -13,9 +13,9 @@
13 13 protected $gateway;
14 14
15 15 protected $allowed_country_codes;
16 16
17 - public function initialize()
17 + public function initialize(): void
18 18 {
19 19 if (class_exists('WC_Blocks_Utils')) {
20 20 if (\WC_Blocks_Utils::has_block_in_page(wc_get_page_id('checkout'), 'woocommerce/checkout') ||
21 21 \WC_Blocks_Utils::has_block_in_page(wc_get_page_id('cart'), 'woocommerce/cart')
@@ -84,9 +84,13 @@
84 84 // Remove tokenization from supported features if outside allowed amount range
85 85 $features = array_diff($features, ['tokenization']);
86 86 }
87 87
88 - return $features;
88 + // array_diff() preserves original keys, leaving gaps; a PHP array with non-sequential
89 + // keys is JSON-encoded as an object, but WC Blocks' registerPaymentMethod() requires
90 + // supports.features to be a plain array (or undefined), or it throws and the whole
91 + // checkout payment-methods list fails to render.
92 + return array_values($features);
89 93 }
90 94
91 95 /**
92 96 * Returns an associative array of data to be exposed for the payment method's client side.
@@ -112,7 +116,8 @@
112 116 'title' => $this->gateway->title,
113 117 'description' => $this->gateway->description,
114 118 'allowed_country_codes' => $this->allowed_country_codes,
115 119 'save_card' => $save_card,
120 + 'wp_nonce' => wp_create_nonce('woocommerce-process_checkout'),
116 121 ];
117 122 }
118 123 }