Skip to content

Commit

Permalink
Updates to 6.0.28
Browse files Browse the repository at this point in the history
  • Loading branch information
Woo committed Jul 3, 2024
1 parent 4fbcfe2 commit 5ca7f7d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 28 deletions.
29 changes: 16 additions & 13 deletions admin/dashboard-widgets/key-figures.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ protected function get_figures() {
}

$optins_count = $this->controller->get_optins_count();
$carts_count = $this->controller->get_active_carts_count();
$guests_count = $this->controller->get_guests_count();
$queued_count = $this->controller->get_queued_count();

$figures[] = [
Expand All @@ -39,17 +37,22 @@ protected function get_figures() {
'link' => Admin::page_url( 'queue' ),
];

$figures[] = [
'name' => __( 'active carts', 'automatewoo' ),
'value' => $carts_count,
'link' => Admin::page_url( 'carts' ),
];

$figures[] = [
'name' => __( 'guests captured', 'automatewoo' ),
'value' => $guests_count,
'link' => Admin::page_url( 'guests' ),
];
if ( Options::abandoned_cart_enabled() ) {
$carts_count = $this->controller->get_active_carts_count();
$guests_count = $this->controller->get_guests_count();

$figures[] = [
'name' => __( 'active carts', 'automatewoo' ),
'value' => $carts_count,
'link' => Admin::page_url( 'carts' ),
];

$figures[] = [
'name' => __( 'guests captured', 'automatewoo' ),
'value' => $guests_count,
'link' => Admin::page_url( 'guests' ),
];
}

$figures[] = [
'name' => Options::optin_enabled() ? __( 'opt-ins', 'automatewoo' ) : __( 'opt-outs', 'automatewoo' ),
Expand Down
4 changes: 2 additions & 2 deletions automatewoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: AutomateWoo
* Plugin URI: https://automatewoo.com
* Description: Powerful marketing automation for your WooCommerce store.
* Version: 6.0.27
* Version: 6.0.28
* Author: WooCommerce
* Author URI: https://woocommerce.com
* License: GPLv3
Expand Down Expand Up @@ -37,7 +37,7 @@
defined( 'ABSPATH' ) || exit;

define( 'AUTOMATEWOO_SLUG', 'automatewoo' );
define( 'AUTOMATEWOO_VERSION', '6.0.27' ); // WRCS: DEFINED_VERSION.
define( 'AUTOMATEWOO_VERSION', '6.0.28' ); // WRCS: DEFINED_VERSION.
define( 'AUTOMATEWOO_FILE', __FILE__ );
define( 'AUTOMATEWOO_PATH', __DIR__ );
define( 'AUTOMATEWOO_MIN_PHP_VER', '7.4.0' );
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** AutomateWoo Changelog ***

2024-07-02 - version 6.0.28
* Tweak - Hide active carts and guests captured widgets if cart tracking is disabled.
* Tweak - Remove unused scheduled actions and prevent further actions from being scheduled if job is disabled.

2024-06-25 - version 6.0.27
* Dev - PHPCS for Memberships.
* Dev - PHPCS for Send Email actions.
Expand Down
13 changes: 13 additions & 0 deletions includes/Jobs/AbandonedCarts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use AutomateWoo\DateTime;
use AutomateWoo\Jobs\Traits\ValidateItemAsIntegerId;
use AutomateWoo\OptionsStore;
use AutomateWoo\Options;
use Exception;

defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -129,4 +130,16 @@ protected function process_item( $cart_id, array $args ) {
public function get_interval(): int {
return JobService::TWO_MINUTE_INTERVAL;
}

/**
* If cart tracking is not enabled then disable the job to prevent
* recurring actions from being scheduled.
*
* @since 6.0.28
*
* @return bool
*/
public function is_enabled(): bool {
return Options::abandoned_cart_enabled();
}
}
18 changes: 18 additions & 0 deletions includes/Jobs/AbstractActionSchedulerJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public function get_process_item_hook() {
*/
public function schedule_recurring() {
$interval = apply_filters( "automatewoo/intervals/{$this->get_name()}", $this->get_interval() );

if ( ! $this->is_enabled() ) {
$this->cancel_recurring();
return;
}

if ( ! $this->get_schedule() ) {
$this->action_scheduler->schedule_recurring_action(
time() + $interval,
Expand Down Expand Up @@ -96,4 +102,16 @@ public function cancel_recurring() {
public function get_schedule() {
return $this->action_scheduler->next_scheduled_action( $this->get_schedule_hook() );
}

/**
* If a child class replaces this method and returns `false` then any existing
* scheduled recurring actions will be cancelled and no more will be scheduled.
*
* @since 6.0.28
*
* @return bool
*/
public function is_enabled(): bool {
return true;
}
}
13 changes: 13 additions & 0 deletions includes/Jobs/CleanInactiveCarts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace AutomateWoo\Jobs;

use AutomateWoo\Carts;
use AutomateWoo\Options;

defined( 'ABSPATH' ) || exit;

Expand Down Expand Up @@ -41,4 +42,16 @@ protected function process_item( array $item ) {
public function get_interval() {
return JobService::TWO_DAY_INTERVAL;
}

/**
* If cart tracking is not enabled then disable the job to prevent
* recurring actions from being scheduled.
*
* @since 6.0.28
*
* @return bool
*/
public function is_enabled(): bool {
return Options::abandoned_cart_enabled();
}
}
7 changes: 7 additions & 0 deletions includes/Jobs/RecurringJobInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ public function cancel_recurring();
* Get the next scheduled job
*/
public function get_schedule();

/**
* Determine if the job is enabled
*
* @since 6.0.28
*/
public function is_enabled();
}
16 changes: 9 additions & 7 deletions languages/automatewoo.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPLv3.
msgid ""
msgstr ""
"Project-Id-Version: AutomateWoo 6.0.27\n"
"Project-Id-Version: AutomateWoo 6.0.28\n"
"Report-Msgid-Bugs-To: https://woocommerce.com/my-account/contact-support/\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-06-25T01:58:52+00:00\n"
"POT-Creation-Date: 2024-07-02T04:39:56+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.7.1\n"
"X-Domain: automatewoo\n"
Expand Down Expand Up @@ -615,23 +615,23 @@ msgstr ""
msgid "clicks"
msgstr ""

#: admin/dashboard-widgets/key-figures.php:37
#: admin/dashboard-widgets/key-figures.php:35
msgid "workflows queued"
msgstr ""

#: admin/dashboard-widgets/key-figures.php:43
#: admin/dashboard-widgets/key-figures.php:45
msgid "active carts"
msgstr ""

#: admin/dashboard-widgets/key-figures.php:49
#: admin/dashboard-widgets/key-figures.php:51
msgid "guests captured"
msgstr ""

#: admin/dashboard-widgets/key-figures.php:55
#: admin/dashboard-widgets/key-figures.php:58
msgid "opt-ins"
msgstr ""

#: admin/dashboard-widgets/key-figures.php:55
#: admin/dashboard-widgets/key-figures.php:58
msgid "opt-outs"
msgstr ""

Expand Down Expand Up @@ -3899,6 +3899,7 @@ msgid_plural "Disabled <span class=\"count\">(%s)</span>"
msgstr[0] ""
msgstr[1] ""

#. translators: placeholder is previous workflow title
#: includes/Post_Types.php:95
#: includes/Post_Types.php:98
#: includes/Post_Types.php:101
Expand Down Expand Up @@ -3938,6 +3939,7 @@ msgctxt "used in \"Workflow scheduled for <date>\""
msgid "M j, Y @ G:i"
msgstr ""

#. translators: php date string, see http://php.net/date
#: includes/Post_Types.php:106
msgid "Workflow draft updated."
msgstr ""
Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php return array(
'root' => array(
'name' => 'woocommerce/automatewoo',
'pretty_version' => 'dev-release/6.0.27',
'version' => 'dev-release/6.0.27',
'reference' => '932d017e52cf2e2189136f42dff27ef5ab5b8a4d',
'pretty_version' => 'dev-release/6.0.28',
'version' => 'dev-release/6.0.28',
'reference' => '30c3b3418f62897d10a522d94f8feb1264abbc1e',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => false,
),
'versions' => array(
'woocommerce/automatewoo' => array(
'pretty_version' => 'dev-release/6.0.27',
'version' => 'dev-release/6.0.27',
'reference' => '932d017e52cf2e2189136f42dff27ef5ab5b8a4d',
'pretty_version' => 'dev-release/6.0.28',
'version' => 'dev-release/6.0.28',
'reference' => '30c3b3418f62897d10a522d94f8feb1264abbc1e',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit 5ca7f7d

Please sign in to comment.