Merge pull request #22871 from woocommerce/add/marketplace-suggestions-wccom-endpoint
Add/marketplace suggestions wccom endpoint
This commit is contained in:
commit
57cb4b2beb
|
@ -248,18 +248,18 @@
|
||||||
|
|
||||||
// hide promos for things the user already has installed
|
// hide promos for things the user already has installed
|
||||||
promos = _.filter( promos, function( promo ) {
|
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
|
// hide promos that are not applicable based on user's installed extensions
|
||||||
promos = _.filter( promos, function( promo ) {
|
promos = _.filter( promos, function( promo ) {
|
||||||
if ( ! promo['show-if-installed'] ) {
|
if ( ! promo['show-if-active'] ) {
|
||||||
// this promotion is relevant to all
|
// this promotion is relevant to all
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the user has any of the prerequisites, show the promo
|
// 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;
|
return promos;
|
||||||
|
|
|
@ -49,7 +49,7 @@ class WC_Marketplace_Updater {
|
||||||
|
|
||||||
$data['updated'] = time();
|
$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 );
|
$request = wp_safe_remote_get( $url );
|
||||||
|
|
||||||
if ( is_wp_error( $request ) ) {
|
if ( is_wp_error( $request ) ) {
|
||||||
|
|
Loading…
Reference in New Issue