Merge pull request #22871 from woocommerce/add/marketplace-suggestions-wccom-endpoint

Add/marketplace suggestions wccom endpoint
This commit is contained in:
Rua Haszard 2019-03-01 07:17:27 +13:00 committed by GitHub
commit 57cb4b2beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -248,18 +248,18 @@
// hide promos for things the user already has installed
promos = _.filter( promos, function( promo ) {
return ! _.contains( marketplace_suggestions.active_plugins, promo['hide-if-installed'] );
return ! _.contains( marketplace_suggestions.active_plugins, promo['hide-if-active'] );
} );
// hide promos that are not applicable based on user's installed extensions
promos = _.filter( promos, function( promo ) {
if ( ! promo['show-if-installed'] ) {
if ( ! promo['show-if-active'] ) {
// this promotion is relevant to all
return true;
}
// if the user has any of the prerequisites, show the promo
return ( _.intersection( marketplace_suggestions.active_plugins, promo['show-if-installed'] ).length > 0 );
return ( _.intersection( marketplace_suggestions.active_plugins, promo['show-if-active'] ).length > 0 );
} );
return promos;

View File

@ -49,7 +49,7 @@ class WC_Marketplace_Updater {
$data['updated'] = time();
$url = 'https://d3t0oesq8995hv.cloudfront.net/add-ons/marketplace-suggestions.json';
$url = 'https://woocommerce.com/wp-json/wccom/marketplace-suggestions/1.0/suggestions.json';
$request = wp_safe_remote_get( $url );
if ( is_wp_error( $request ) ) {