| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | * @wordpress-plugin |
| 15 | 15 | * Plugin Name: MailerLite - WooCommerce integration |
| 16 | 16 | * Plugin URI: https://mailerlite.com |
| 17 | 17 | * Description: Official MailerLite integration for WooCommerce. Track sales and campaign ROI, import products details, automate emails based on purchases and seamlessly add your customers to your email marketing lists via WooCommerce's checkout process. |
| 18 | - * Version: 3.1.17 | |
| 18 | + * Version: 3.1.29 | |
| 19 | 19 | * Author: MailerLite |
| 20 | 20 | * Author URI: https://mailerlite.com |
| 21 | 21 | * License: GPL-2.0+ |
| 22 | 22 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | * Currently plugin version. |
| 39 | 39 | * Start at version 1.0.0 and use SemVer - https://semver.org |
| 40 | 40 | * Update when you release new versions. |
| 41 | 41 | */ |
| 42 | -define( 'WOO_MAILERLITE_VERSION', '3.1.17' ); | |
| 42 | +define( 'WOO_MAILERLITE_VERSION', '3.1.29' ); | |
| 43 | 43 | |
| 44 | 44 | define('WOO_MAILERLITE_ASYNC_JOBS', false); |
| 45 | 45 | |
| 46 | 46 | define('WOO_MAILERLITE_DIR', plugin_dir_path(__FILE__)); |
| @@ -77,8 +77,27 @@ | ||
| 77 | 77 | WooMailerLiteLog()->error('woocommerce_blocks_loaded', ['error' => $e->getMessage(), 'trace' => $e->getTraceAsString()]); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | ); |
| 81 | + | |
| 82 | + if (function_exists('woocommerce_store_api_register_endpoint_data') && | |
| 83 | + class_exists('\Automattic\WooCommerce\StoreApi\Schemas\V1\CheckoutSchema')) { | |
| 84 | + woocommerce_store_api_register_endpoint_data([ | |
| 85 | + 'endpoint' => \Automattic\WooCommerce\StoreApi\Schemas\V1\CheckoutSchema::IDENTIFIER, | |
| 86 | + 'namespace' => 'woo-mailerlite', | |
| 87 | + 'schema_callback' => function () { | |
| 88 | + return [ | |
| 89 | + 'subscribe' => [ | |
| 90 | + 'description' => 'Whether the customer consented to marketing emails at checkout.', | |
| 91 | + 'type' => ['boolean', 'null'], | |
| 92 | + 'context' => ['view', 'edit'], | |
| 93 | + 'optional' => true, | |
| 94 | + ], | |
| 95 | + ]; | |
| 96 | + }, | |
| 97 | + 'schema_type' => ARRAY_A, | |
| 98 | + ]); | |
| 99 | + } | |
| 81 | 100 | |
| 82 | 101 | add_filter( |
| 83 | 102 | '__experimental_woocommerce_blocks_add_data_attributes_to_block', |
| 84 | 103 | function ($allowed_blocks) { |