Automattic\WooCommerce\Blocks\Patterns
PTKPatternsStore::fetch_patterns
Reset the cached patterns and fetch them again from the PTK API.
Метод класса: PTKPatternsStore{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$PTKPatternsStore = new PTKPatternsStore(); $PTKPatternsStore->fetch_patterns();
Код PTKPatternsStore::fetch_patterns() PTKPatternsStore::fetch patterns WC 10.4.3
public function fetch_patterns() {
if ( ! $this->allowed_tracking_is_enabled() ) {
return;
}
$patterns = $this->ptk_client->fetch_patterns(
array(
// This is the site where the patterns are stored. Despite the 'wpcomstaging.com' domain suggesting a staging environment, this URL points to the production environment where stable versions of the patterns are maintained.
'site' => 'wooblockpatterns.wpcomstaging.com',
'categories' => array(
'_woo_intro',
'_woo_featured_selling',
'_woo_about',
'_woo_reviews',
'_woo_social_media',
'_woo_woocommerce',
'_dotcom_imported_intro',
'_dotcom_imported_about',
'_dotcom_imported_services',
'_dotcom_imported_reviews',
),
)
);
if ( is_wp_error( $patterns ) ) {
wc_get_logger()->warning(
sprintf(
// translators: %s is a generated error message.
__( 'Failed to get WooCommerce patterns from the PTK: "%s"', 'woocommerce' ),
$patterns->get_error_message()
),
);
return;
}
$patterns = $this->filter_patterns( $patterns );
$patterns = $this->map_categories( $patterns );
update_option( self::OPTION_NAME, $patterns, false );
}