Fix WooCommerce block's checkout error when opt-in is disabled

When opt-in is disabled it fails to validate checkout data, because it expects
mailpoet.optin to present. This PRs skips extending checkout data schema in case
the opt-in is disabled.
[MAILPOET-4004]
This commit is contained in:
Rostislav Wolny
2021-12-06 18:30:35 +01:00
committed by Veljko V
parent 93cfc4d251
commit 1bc968e55f

View File

@@ -83,6 +83,9 @@ class WooCommerceBlocksIntegration {
}
public function extendRestApi() {
if (!$this->settings->get('woocommerce.optin_on_checkout.enabled', false)) {
return;
}
$extend = Package::container()->get(ExtendRestApi::class);
$extend->register_endpoint_data(
[