Skip to content

Commit 8d9fa3c

Browse files
authored
Merge pull request #168 from WebDevStudios/release210
Release 2.1.0
2 parents a53b991 + 74bbcc6 commit 8d9fa3c

File tree

22 files changed

+348
-166
lines changed

22 files changed

+348
-166
lines changed

.wordpress-org/screenshot-5.png

681 KB
Loading

.wordpress-org/screenshot-6.png

497 KB
Loading

README.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== Constant Contact + WooCommerce ===
2-
Contributors: constantcontact, webdevstudios, znowebdev, jmichaelward, ggwicz, ravedev
2+
Contributors: constantcontact, webdevstudios, znowebdev, jmichaelward, ggwicz, ravedev, newyorkerlaura
33
Tags: Constant Contact, WooCommerce, eCommerce, email marketing, marketing automation, email, form, forms, marketing, mobile, opt-in, plugin, signup, subscribe, subscription, widget
44
Requires at least: 5.2.2
5-
Tested up to: 6.0.2
6-
Stable tag: 2.0.3
5+
Tested up to: 6.2.0
6+
Stable tag: 2.1.0
77
Requires PHP: 7.2
88
License: GPLv3
99

@@ -53,6 +53,8 @@ https://www.youtube.com/watch?v=ZH9G4yhAngk
5353
2. Edit the details of your product.
5454
3. Pre-filtered segmented lists.
5555
4. Syncing status for contacts.
56+
5. Settings Page in WordPress
57+
6. Before and after connecting account.
5658

5759
#### Overall WooCommerce and Constant Contact Guide
5860
Our WooCommerce integration is designed to help make your email marketing even easier. You can automatically sync your WooCommerce contacts right into your Constant Contact account, promote your products and services in emails, and recover lost revenue with automated abandoned cart emails!
@@ -80,26 +82,32 @@ You've connected your WooCommerce store to Constant Contact, promoted your WooCo
8082
[Learn more with our step-by-step revenue reporting guide.](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/36892-View-Recovered-Revenue-from-the-WooCommerce-Abandoned-Cart-Reminder-Email?q=woocommerce*&lang=en_US)
8183

8284
== Changelog ==
85+
86+
= 2.1.0 =
87+
* Added - Logging to help troubleshoot potential issues.
88+
* Updates - Store a bit more customer information for abandoned cart reachout purposes.
89+
* Updates - URLs used during the connection process and account associations.
90+
8391
= 2.0.3 =
8492

85-
* Fix - Minor design fixes, bug fixes and stability improvements.
93+
* Fix - Minor design fixes, bug fixes and stability improvements.
8694

8795
= 2.0.2 =
8896

89-
* Fix - Minor bug fixes and stability improvements.
97+
* Fix - Minor bug fixes and stability improvements.
9098

9199
= 2.0.1 =
92100

93-
* Fix - Fixed an issue with notice not working when ssl is found.
94-
* Fix - Minor typo fixes.
101+
* Fix - Fixed an issue with notice not working when ssl is found.
102+
* Fix - Minor typo fixes.
95103

96104
= 2.0.0 =
97105

98106
* Updated - All new ui for the constant contact woocommerce plugin.
99107
* Updated - Store data are now optional. You can connect to constantcontact without store details.
100108
* Updated - Now you can save your settings and connect to constant contact in a single click.
101109
* Updated - Added a disconnect settings to the constant contact woocommerce settings.
102-
* Fix - Minor bug fixes.
110+
* Fix - Minor bug fixes.
103111

104112

105113
== Installation ==

plugin.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<?php
22
/**
33
* Constant Contact + WooCommerce
4-
*
54
* @since 2019-02-15
65
* @author Constant Contact <https://www.constantcontact.com/>
76
* @package cc-woo
8-
*
97
* @wordpress-plugin
108
* Plugin Name: Constant Contact + WooCommerce
119
* Description: Add products to your emails and sync your contacts.
1210
* Plugin URI: https://github.com/WebDevStudios/constant-contact-woocommerce
13-
* Version: 2.0.3
11+
* Version: 2.1.0
1412
* Author: Constant Contact
1513
* Author URI: https://www.constantcontact.com/
16-
* Text Domain: cc-woo
14+
* Text Domain: constant-contact-woocommerce
1715
* WC requires at least: 3.6.0
1816
* WC tested up to: 6.8.2
1917
* Requires PHP: 7.2
@@ -26,7 +24,7 @@
2624

2725
if ( ! is_readable( $cc_woo_autoloader ) ) {
2826
/* Translators: Placeholder is the current directory. */
29-
throw new \Exception( sprintf( __( 'Please run `composer install` in the plugin folder "%s" and try activating this plugin again.', 'cc-woo' ), dirname( __FILE__ ) ) );
27+
throw new \Exception( sprintf( __( 'Please run `composer install` in the plugin folder "%s" and try activating this plugin again.', 'constant-contact-woocommerce' ), dirname( __FILE__ ) ) );
3028
}
3129

3230
require_once $cc_woo_autoloader;

src/AbandonedCheckouts/CheckoutHandler.php

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function maybe_capture_guest_checkout() {
7676
] );
7777

7878
if ( empty( $data['nonce'] ) || ! wp_verify_nonce( $data['nonce'], 'woocommerce-process_checkout' ) ) {
79-
wp_send_json_error( esc_html__( 'Invalid nonce.', 'cc-woo' ) );
79+
wp_send_json_error( esc_html__( 'Invalid nonce.', 'constant-contact-woocommerce' ) );
8080
}
8181

8282
$email = filter_var( $data['email'], FILTER_VALIDATE_EMAIL );
8383

8484
if ( ! $email ) {
85-
wp_send_json_error( esc_html__( 'Invalid email.', 'cc-woo' ) );
85+
wp_send_json_error( esc_html__( 'Invalid email.', 'constant-contact-woocommerce' ) );
8686
}
8787

8888
WC()->session->set( 'billing_email', $email );
@@ -213,6 +213,24 @@ protected function save_checkout_data( string $billing_email = '', bool $is_chec
213213
$is_checkout = $is_checkout ?: is_checkout();
214214
$checkout_uuid = WC()->session->get( 'checkout_uuid' );
215215

216+
$addresses = [];
217+
218+
foreach( $this->get_the_address_fields() as $field ) {
219+
$value = '';
220+
221+
$value_session = WC()->session->get( $field );
222+
if ( ! empty( $value_session ) ) {
223+
$value = $value_session;
224+
} else {
225+
$value_checkout = WC()->checkout->get_value( $field );
226+
if ( ! empty( $value_checkout ) ) {
227+
$value = $value_checkout;
228+
}
229+
}
230+
231+
$addresses[ $field ] = $value;
232+
}
233+
216234
if ( empty( $billing_email ) ) {
217235
return;
218236
}
@@ -271,6 +289,7 @@ protected function save_checkout_data( string $billing_email = '', bool $is_chec
271289
maybe_serialize( [
272290
'products' => array_values( WC()->cart->get_cart() ),
273291
'coupons' => WC()->cart->get_applied_coupons(),
292+
'addresses' => $addresses,
274293
] ),
275294
$current_time,
276295
strtotime( $current_time ),
@@ -345,4 +364,35 @@ public function delete_expired_checkouts() {
345364
)
346365
);
347366
}
367+
368+
/**
369+
* Return array of address fields we want.
370+
*
371+
* @author Michael Beckwith <[email protected]>
372+
* @since 2.1.0
373+
*/
374+
protected function get_the_address_fields() {
375+
return [
376+
'address_1',
377+
'address_2',
378+
'city',
379+
'country',
380+
'postcode',
381+
'state',
382+
'shipping_address_1',
383+
'shipping_address_2',
384+
'shipping_city',
385+
'shipping_country',
386+
'shipping_postcode',
387+
'shipping_state',
388+
'billing_address_1',
389+
'billing_address_2',
390+
'billing_city',
391+
'billing_country',
392+
'billing_postcode',
393+
'billing_state',
394+
'billing_phone',
395+
'billing_email',
396+
];
397+
}
348398
}

src/AbandonedCheckouts/CheckoutRecovery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function recover_products( $products ) {
142142
'%d item from your previous order is currently unavailable and could not be added to your cart.',
143143
'%d items from your previous order are currently unavailable and could not be added to your cart.',
144144
( count( $products ) - count( $products_added ) ),
145-
'cc-woo'
145+
'constant-contact-woocommerce'
146146
),
147147
( count( $products ) - count( $products_added ) )
148148
),

src/Api/KeyManager.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace WebDevStudios\CCForWoo\Api;
1010

1111
use WebDevStudios\OopsWP\Structure\Service;
12+
use WebDevStudios\CCForWoo\Utility\DebugLogging;
1213

1314
/**
1415
* KeyManager class
@@ -56,6 +57,13 @@ public function maybe_revoke_api_key( string $query ) : string {
5657
*/
5758
do_action( 'cc_woo_key_revoked' );
5859

60+
$ctct_logger = new DebugLogging(
61+
wc_get_logger(),
62+
'WooCommerce API Key with Constant Contact revoked',
63+
'info'
64+
);
65+
$ctct_logger->log();
66+
5967
return $query;
6068
}
6169

@@ -144,7 +152,7 @@ private function is_woo_commerce_api_key_query( $query ) {
144152
public function disconnect_cc_woo() {
145153

146154
/* This action is documented in Plugin.php */
147-
do_action( 'cc_woo_disconnect', esc_html__( 'REST API Key Revoked.', 'cc-woo' ) );
155+
do_action( 'cc_woo_disconnect', esc_html__( 'REST API Key Revoked.', 'constant-contact-woocommerce' ) );
148156

149157
/* This action is documented in Plugin.php */
150158
do_action( 'wc_ctct_disconnect' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Intentional improperly-prefixed hookname, used in webhooks.

src/Meta/ConnectionStatus.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace WebDevStudios\CCForWoo\Meta;
1111

12+
use WebDevStudios\CCForWoo\Utility\DebugLogging;
13+
1214
/**
1315
* Class PluginOption
1416
*
@@ -105,5 +107,13 @@ public function set_connection( int $connected, int $user_id ) {
105107
if ( $this->connected ) {
106108
update_option( self::CC_FIRST_CONNECTION, true );
107109
}
110+
111+
$ctct_logger = new DebugLogging(
112+
wc_get_logger(),
113+
'Constant Contact connection set',
114+
'info',
115+
[ 'status' => $connected ]
116+
);
117+
$ctct_logger->log();
108118
}
109119
}

src/Plugin.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function add_ssl_notice() {
108108
$connected = get_option( 'cc_woo_import_connection_established' );
109109

110110
if ( ! $connected && ( isset( $_SERVER['HTTPS'] ) && 'on' !== $_SERVER['HTTPS'] ) ) {
111-
$message = __( 'Your site does not appear to be using a secure connection (SSL). You might face issues when connecting to your account. Please add HTTPS to your site to make sure you have no issues connecting.', 'cc-woo' );
111+
$message = __( 'Your site does not appear to be using a secure connection (SSL). You might face issues when connecting to your account. Please add HTTPS to your site to make sure you have no issues connecting.', 'constant-contact-woocommerce' );
112112
new Notice(
113113
new NoticeMessage( $message, 'error', true )
114114
);
@@ -138,7 +138,7 @@ private function deactivate( $reason ) {
138138
*
139139
* @param string $message Deactivation message.
140140
*/
141-
do_action( 'cc_woo_disconnect', esc_html__( 'Plugin deactivated.', 'cc-woo' ) );
141+
do_action( 'cc_woo_disconnect', esc_html__( 'Plugin deactivated.', 'constant-contact-woocommerce' ) );
142142

143143
$this->do_deactivation_process();
144144

@@ -167,13 +167,13 @@ public function check_for_required_dependencies() {
167167
// Ensure requirements.
168168
if ( ! $compatibility_checker->is_available() ) {
169169
// translators: placeholder is the minimum supported WooCommerce version.
170-
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater must be installed and activated to use %2$s.', 'cc-woo' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
170+
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater must be installed and activated to use %2$s.', 'constant-contact-woocommerce' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
171171
throw new Exception( $message );
172172
}
173173

174174
if ( ! $compatibility_checker->is_compatible( \WooCommerce::instance() ) ) {
175175
// translators: placeholder is the minimum supported WooCommerce version.
176-
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater is required to use %2$s.', 'cc-woo' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
176+
$message = sprintf( esc_html__( 'WooCommerce version "%1$s" or greater is required to use %2$s.', 'constant-contact-woocommerce' ), PluginCompatibilityCheck::MINIMUM_WOO_VERSION, self::PLUGIN_NAME );
177177
throw new Exception( $message );
178178
}
179179
} catch ( Exception $e ) {
@@ -210,6 +210,7 @@ public function register_hooks() {
210210
add_action( 'plugins_loaded', [ $this, 'check_for_required_dependencies' ] );
211211
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
212212
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 99 );
213+
add_action( 'init', [ $this, 'load_plugin_textdomain' ] );
213214

214215
register_activation_hook( $this->plugin_file, [ $this, 'do_activation_process' ] );
215216
register_deactivation_hook( $this->plugin_file, [ $this, 'do_deactivation_process' ] );
@@ -327,7 +328,7 @@ public function do_deactivation_process() {
327328
delete_option( ConnectionStatus::CC_CONNECTION_USER_ID );
328329
delete_option( ConnectionStatus::CC_FIRST_CONNECTION );
329330
delete_option( ConnectionStatus::CC_CONNECTION_ESTABLISHED_KEY );
330-
331+
331332

332333
// WooCommerce Options
333334
delete_option( 'cc_woo_store_information_first_name' );
@@ -366,5 +367,15 @@ public function admin_enqueue_scripts() {
366367
wp_enqueue_style( 'cc-woo-admin', trailingslashit( plugin_dir_url( $this->get_plugin_file() ) ) . 'app/admin.css' );
367368
wp_enqueue_style( 'cc-woo-google-fonts', 'https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;700&display=swap', false );
368369
}
370+
371+
/**
372+
* Load textdomain.
373+
*
374+
* @author Michael Beckwith <[email protected]>
375+
* @since 2.1.0
376+
*/
377+
public function load_plugin_textdomain() {
378+
load_plugin_textdomain( 'constant-contact-woocommerce' );
379+
}
369380
}
370381

src/Rest/AbandonedCheckouts/Controller.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace WebDevStudios\CCForWoo\Rest\AbandonedCheckouts;
1010

11+
use WebDevStudios\CCForWoo\Utility\DebugLogging;
1112
use WP_REST_Server;
1213
use WP_REST_Request;
1314
use WP_REST_Controller;
@@ -79,7 +80,16 @@ public function register_routes() {
7980
*/
8081
public function get_items_permissions_check( $request ) {
8182
if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) {
82-
return new WP_Error( 'cc-woo-rest-not-allowed', esc_html__( 'Sorry, you cannot list resources.', 'cc-woo' ), [ 'status' => rest_authorization_required_code() ] );
83+
84+
$ctct_logger = new DebugLogging(
85+
wc_get_logger(),
86+
'CTCT Woo: no permission to check abandoned checkout',
87+
'warning',
88+
[ 'cc-woo-rest-not-allowed' => $request ]
89+
);
90+
$ctct_logger->log();
91+
92+
return new WP_Error( 'cc-woo-rest-not-allowed', esc_html__( 'Sorry, you cannot list resources.', 'constant-contact-woocommerce' ), [ 'status' => rest_authorization_required_code() ] );
8393
}
8494

8595
return true;

0 commit comments

Comments
 (0)