Delete old marketing recommendations transient upon update to WC 8.6.0 (#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.
This commit is contained in:
Gan Eng Chin 2024-01-10 21:05:36 +08:00 committed by GitHub
parent e24aabff04
commit 0636a09f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Delete old marketing recommendations transient upon update to WooCommerce 8.6.0.

View File

@ -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',
),
);
/**

View File

@ -2640,3 +2640,12 @@ LIMIT 250
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' );
}