Skip to content

Commit

Permalink
Delete old marketing recommendations transient upon update to WC 8.6.0 (
Browse files Browse the repository at this point in the history
woocommerce#43162)

* Add MarketingRecommendations feature.

The code here is based on other feature with default fallbacks and with data source poller, e.g. see payment gateway suggestions.

* Use MarketingRecommendations feature in API.

* Add spec_key for MarketingRecommendationsDataSourcePoller.

If we don't specify it, the default is `id`, which is not used in our recommendation data, and this will cause things not to work as expected.

* Recursively convert object to array.

This is because all the subsequent functions work with arrays, not objects.

* Make recommended marketing tools and coupons use MarketingRecommendationsInit.

This is so that recommended channels, tools, and coupons make use of the same transient data with data source poller.

* Add changelog.

* Fix PHP lint issues.

* Add doc comment to fix lint error.

* Fix tests in MarketingRecommendationsTest.

* Replace recommendations.json file with generated data in DefaultMarketingRecommendations.

This is to have i18n support.

* Add icons for fallback marketing recommendations.

* Fix PHP linting issue.

* Fix linting issue.

* Fix failing tests with PHP 8.0.

* Remove unused replaced code in MarketingSpecs.

* Delete old marketing recommendations transient upon update to WC 8.6.0.

* Add changelog.
  • Loading branch information
ecgan authored Jan 10, 2024
1 parent e24aabf commit 0636a09
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/remove-old-marketing-transient
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Delete old marketing recommendations transient upon update to WooCommerce 8.6.0.
3 changes: 3 additions & 0 deletions plugins/woocommerce/includes/class-wc-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ class WC_Install {
'8.1.0' => array(
'wc_update_810_migrate_transactional_metadata_for_hpos',
),
'8.6.0' => array(
'wc_update_860_remove_recommended_marketing_plugins_transient',
),
);

/**
Expand Down
9 changes: 9 additions & 0 deletions plugins/woocommerce/includes/wc-update-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2640,3 +2640,12 @@ function wc_update_810_migrate_transactional_metadata_for_hpos() {
return ! empty( $has_pending );
}

/**
* Remove the transient data for recommended marketing extensions.
*
* This is removed because it is not used anymore.
* It is replaced by `woocommerce_admin_marketing_recommendations_specs` transient that is created by `MarketingRecommendationsDataSourcePoller`.
*/
function wc_update_860_remove_recommended_marketing_plugins_transient() {
delete_transient( 'wc_marketing_recommended_plugins' );
}

0 comments on commit 0636a09

Please sign in to comment.