rebase code on oct-10-2023
This commit is contained in:
@@ -97,37 +97,7 @@ class OnboardingFreeExtensions extends WC_REST_Data_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
$extensions = $this->replace_jetpack_with_jetpack_boost_for_treatment( $extensions );
|
||||
|
||||
return new WP_REST_Response( $extensions );
|
||||
}
|
||||
|
||||
private function replace_jetpack_with_jetpack_boost_for_treatment( array $extensions ) {
|
||||
$is_treatment = \WooCommerce\Admin\Experimental_Abtest::in_treatment( 'woocommerce_jetpack_copy' );
|
||||
|
||||
if ( ! $is_treatment ) {
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
$has_core_profiler = array_search( 'obw/core-profiler', array_column( $extensions, 'key' ) );
|
||||
|
||||
if ( $has_core_profiler === false ) {
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
$has_jetpack = array_search( 'jetpack', array_column( $extensions[ $has_core_profiler ]['plugins'], 'key' ) );
|
||||
|
||||
if ( $has_jetpack === false ) {
|
||||
return $extensions;
|
||||
}
|
||||
|
||||
$jetpack = &$extensions[ $has_core_profiler ]['plugins'][ $has_jetpack ];
|
||||
$jetpack->key = 'jetpack-boost';
|
||||
$jetpack->name = 'Jetpack Boost';
|
||||
$jetpack->label = __( 'Optimize store performance with Jetpack Boost', 'woocommerce' );
|
||||
$jetpack->description = __( 'Speed up your store and improve your SEO with performance-boosting tools from Jetpack. Learn more', 'woocommerce' );
|
||||
$jetpack->learn_more_link = 'https://jetpack.com/boost/';
|
||||
|
||||
return $extensions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,6 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
|
||||
'items' => array(
|
||||
'enum' => array(
|
||||
'jetpack',
|
||||
'jetpack-boost',
|
||||
'woocommerce-services',
|
||||
'woocommerce-payments',
|
||||
'mailchimp-for-woocommerce',
|
||||
|
||||
@@ -39,7 +39,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
/**
|
||||
* Duration to milisecond mapping.
|
||||
*
|
||||
* @var array
|
||||
* @var string
|
||||
*/
|
||||
protected $duration_to_ms = array(
|
||||
'day' => DAY_IN_SECONDS * 1000,
|
||||
@@ -762,7 +762,6 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
|
||||
if ( ! $task && $id ) {
|
||||
$task = new DeprecatedExtendedTask(
|
||||
null,
|
||||
array(
|
||||
'id' => $id,
|
||||
'is_dismissable' => true,
|
||||
@@ -796,7 +795,6 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
|
||||
if ( ! $task && $id ) {
|
||||
$task = new DeprecatedExtendedTask(
|
||||
null,
|
||||
array(
|
||||
'id' => $id,
|
||||
'is_dismissable' => true,
|
||||
@@ -839,7 +837,6 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
|
||||
if ( ! $task && $task_id ) {
|
||||
$task = new DeprecatedExtendedTask(
|
||||
null,
|
||||
array(
|
||||
'id' => $task_id,
|
||||
'is_snoozeable' => true,
|
||||
@@ -877,7 +874,6 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
|
||||
if ( ! $task && $id ) {
|
||||
$task = new DeprecatedExtendedTask(
|
||||
null,
|
||||
array(
|
||||
'id' => $id,
|
||||
'is_snoozeable' => true,
|
||||
@@ -965,7 +961,6 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
|
||||
|
||||
if ( ! $task && $id ) {
|
||||
$task = new DeprecatedExtendedTask(
|
||||
null,
|
||||
array(
|
||||
'id' => $id,
|
||||
)
|
||||
|
||||
@@ -30,13 +30,6 @@ class DataStore extends SqlQuery {
|
||||
*/
|
||||
protected $cache_timeout = 3600;
|
||||
|
||||
/**
|
||||
* Cache identifier.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $cache_key = '';
|
||||
|
||||
/**
|
||||
* Table used as a data store for this report.
|
||||
*
|
||||
|
||||
@@ -542,87 +542,6 @@ class Segmenter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate segments for totals where the segmenting property is bound to product (e.g. category, product_id, variation_id).
|
||||
*
|
||||
* @param array $segmenting_selections SELECT part of segmenting SQL query--one for 'product_level' and one for 'order_level'.
|
||||
* @param string $segmenting_from FROM part of segmenting SQL query.
|
||||
* @param string $segmenting_where WHERE part of segmenting SQL query.
|
||||
* @param string $segmenting_groupby GROUP BY part of segmenting SQL query.
|
||||
* @param string $segmenting_dimension_name Name of the segmenting dimension.
|
||||
* @param string $table_name Name of SQL table which is the stats table for orders.
|
||||
* @param array $totals_query Array of SQL clauses for totals query.
|
||||
* @param string $unique_orders_table Name of temporary SQL table that holds unique orders.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_product_related_totals_segments( $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $totals_query, $unique_orders_table ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate segments for intervals where the segmenting property is bound to product (e.g. category, product_id, variation_id).
|
||||
*
|
||||
* @param array $segmenting_selections SELECT part of segmenting SQL query--one for 'product_level' and one for 'order_level'.
|
||||
* @param string $segmenting_from FROM part of segmenting SQL query.
|
||||
* @param string $segmenting_where WHERE part of segmenting SQL query.
|
||||
* @param string $segmenting_groupby GROUP BY part of segmenting SQL query.
|
||||
* @param string $segmenting_dimension_name Name of the segmenting dimension.
|
||||
* @param string $table_name Name of SQL table which is the stats table for orders.
|
||||
* @param array $intervals_query Array of SQL clauses for intervals query.
|
||||
* @param string $unique_orders_table Name of temporary SQL table that holds unique orders.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_product_related_intervals_segments( $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $intervals_query, $unique_orders_table ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate segments for totals query where the segmenting property is bound to order (e.g. coupon or customer type).
|
||||
*
|
||||
* @param string $segmenting_select SELECT part of segmenting SQL query.
|
||||
* @param string $segmenting_from FROM part of segmenting SQL query.
|
||||
* @param string $segmenting_where WHERE part of segmenting SQL query.
|
||||
* @param string $segmenting_groupby GROUP BY part of segmenting SQL query.
|
||||
* @param string $table_name Name of SQL table which is the stats table for orders.
|
||||
* @param array $totals_query Array of SQL clauses for intervals query.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_order_related_totals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $totals_query ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate segments for intervals query where the segmenting property is bound to order (e.g. coupon or customer type).
|
||||
*
|
||||
* @param string $segmenting_select SELECT part of segmenting SQL query.
|
||||
* @param string $segmenting_from FROM part of segmenting SQL query.
|
||||
* @param string $segmenting_where WHERE part of segmenting SQL query.
|
||||
* @param string $segmenting_groupby GROUP BY part of segmenting SQL query.
|
||||
* @param string $table_name Name of SQL table which is the stats table for orders.
|
||||
* @param array $intervals_query Array of SQL clauses for intervals query.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_order_related_intervals_segments( $segmenting_select, $segmenting_from, $segmenting_where, $segmenting_groupby, $table_name, $intervals_query ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of segments formatted for REST response.
|
||||
*
|
||||
* @param string $type Type of segments to return--'totals' or 'intervals'.
|
||||
* @param array $query_params SQL query parameter array.
|
||||
* @param string $table_name Name of main SQL table for the data store (used as basis for JOINS).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_segments( $type, $query_params, $table_name ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate segments for segmenting property bound to product (e.g. category, product_id, variation_id).
|
||||
*
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\BlockTemplates;
|
||||
|
||||
/**
|
||||
* Interface for block containers.
|
||||
*/
|
||||
interface BlockContainerInterface extends BlockInterface, ContainerInterface {}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\BlockTemplates;
|
||||
|
||||
/**
|
||||
* Interface for block configuration used to specify blocks in BlockTemplate.
|
||||
*/
|
||||
interface BlockInterface {
|
||||
/**
|
||||
* Key for the block name in the block configuration.
|
||||
*/
|
||||
public const NAME_KEY = 'blockName';
|
||||
|
||||
/**
|
||||
* Key for the block ID in the block configuration.
|
||||
*/
|
||||
public const ID_KEY = 'id';
|
||||
|
||||
/**
|
||||
* Key for the internal order in the block configuration.
|
||||
*/
|
||||
public const ORDER_KEY = 'order';
|
||||
|
||||
/**
|
||||
* Key for the block attributes in the block configuration.
|
||||
*/
|
||||
public const ATTRIBUTES_KEY = 'attributes';
|
||||
|
||||
/**
|
||||
* Get the block name.
|
||||
*/
|
||||
public function get_name(): string;
|
||||
|
||||
/**
|
||||
* Get the block ID.
|
||||
*/
|
||||
public function get_id(): string;
|
||||
|
||||
/**
|
||||
* Get the block order.
|
||||
*/
|
||||
public function get_order(): int;
|
||||
|
||||
/**
|
||||
* Set the block order.
|
||||
*
|
||||
* @param int $order The block order.
|
||||
*/
|
||||
public function set_order( int $order );
|
||||
|
||||
/**
|
||||
* Get the block attributes.
|
||||
*/
|
||||
public function get_attributes(): array;
|
||||
|
||||
/**
|
||||
* Set the block attributes.
|
||||
*
|
||||
* @param array $attributes The block attributes.
|
||||
*/
|
||||
public function set_attributes( array $attributes );
|
||||
|
||||
/**
|
||||
* Get the parent container that the block belongs to.
|
||||
*/
|
||||
public function &get_parent(): ?ContainerInterface;
|
||||
|
||||
/**
|
||||
* Get the root template that the block belongs to.
|
||||
*/
|
||||
public function &get_root_template(): BlockTemplateInterface;
|
||||
|
||||
/**
|
||||
* Get the block configuration as a formatted template.
|
||||
*
|
||||
* @return array The block configuration as a formatted template.
|
||||
*/
|
||||
public function get_formatted_template(): array;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\BlockTemplates;
|
||||
|
||||
/**
|
||||
* Interface for block-based template.
|
||||
*/
|
||||
interface BlockTemplateInterface extends ContainerInterface {
|
||||
/**
|
||||
* Get the template ID.
|
||||
*/
|
||||
public function get_id(): string;
|
||||
|
||||
/**
|
||||
* Get the template title.
|
||||
*/
|
||||
public function get_title(): string;
|
||||
|
||||
/**
|
||||
* Get the template description.
|
||||
*/
|
||||
public function get_description(): string;
|
||||
|
||||
/**
|
||||
* Get the template area.
|
||||
*/
|
||||
public function get_area(): string;
|
||||
|
||||
/**
|
||||
* Get a block by ID.
|
||||
*
|
||||
* @param string $block_id The block ID.
|
||||
*/
|
||||
public function get_block( string $block_id ): ?BlockInterface;
|
||||
|
||||
/**
|
||||
* Generate a block ID based on a base.
|
||||
*
|
||||
* @param string $id_base The base to use when generating an ID.
|
||||
* @return string
|
||||
*/
|
||||
public function generate_block_id( string $id_base ): string;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\BlockTemplates;
|
||||
|
||||
/**
|
||||
* Interface for block containers.
|
||||
*/
|
||||
interface ContainerInterface {
|
||||
/**
|
||||
* Get the root template that the block belongs to.
|
||||
*/
|
||||
public function &get_root_template(): BlockTemplateInterface;
|
||||
|
||||
/**
|
||||
* Get the block configuration as a formatted template.
|
||||
*/
|
||||
public function get_formatted_template(): array;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class Package {
|
||||
*/
|
||||
public static function init() {
|
||||
// Avoid double initialization when the feature plugin is in use.
|
||||
if (defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
||||
if ( defined( 'WC_ADMIN_VERSION_NUMBER' ) ) {
|
||||
self::$active_version = WC_ADMIN_VERSION_NUMBER;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
* A facade to allow deprecating an entire class.
|
||||
*/
|
||||
class DeprecatedClassFacade {
|
||||
|
||||
/**
|
||||
* The instance that this facade covers over.
|
||||
*
|
||||
@@ -33,21 +32,6 @@ class DeprecatedClassFacade {
|
||||
*/
|
||||
protected $instance;
|
||||
|
||||
/**
|
||||
* The name of the non-deprecated class that this facade covers.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $facade_over_classname;
|
||||
|
||||
/**
|
||||
* The version that this class was deprecated in.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $deprecated_in_version = '';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
||||
@@ -21,13 +21,6 @@ class Favorites {
|
||||
*/
|
||||
const META_NAME = 'navigation_favorites';
|
||||
|
||||
/**
|
||||
* Favorites instance.
|
||||
*
|
||||
* @var Favorites|null
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Get class instance.
|
||||
*/
|
||||
|
||||
@@ -16,27 +16,6 @@ class DeprecatedExtendedTask extends Task {
|
||||
*/
|
||||
public $id = '';
|
||||
|
||||
/**
|
||||
* Additional info.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $additional_info = '';
|
||||
|
||||
/**
|
||||
* Content.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $content = '';
|
||||
|
||||
/**
|
||||
* Whether the task is complete or not.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $is_complete = false;
|
||||
|
||||
/**
|
||||
* Snoozeable.
|
||||
*
|
||||
@@ -51,35 +30,6 @@ class DeprecatedExtendedTask extends Task {
|
||||
*/
|
||||
public $is_dismissable = false;
|
||||
|
||||
/**
|
||||
* Whether the store is capable of viewing the task.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $can_view = true;
|
||||
|
||||
/**
|
||||
* Level.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $level = 3;
|
||||
|
||||
/**
|
||||
* Time.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $time;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title = '';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -36,10 +36,7 @@ class TaskLists {
|
||||
protected static $default_tasks_loaded = false;
|
||||
|
||||
/**
|
||||
* The contents of this array is used in init_tasks() to run their init() methods.
|
||||
* If the classes do not have an init() method then nothing is executed.
|
||||
* Beyond that, adding tasks to this list has no effect, see init_default_lists() for the list of tasks.
|
||||
* that are added for each task list.
|
||||
* Array of default tasks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
@@ -112,7 +109,6 @@ class TaskLists {
|
||||
*/
|
||||
public static function init_default_lists() {
|
||||
$tasks = array(
|
||||
'CustomizeStore',
|
||||
'StoreDetails',
|
||||
'Purchase',
|
||||
'Products',
|
||||
@@ -125,18 +121,7 @@ class TaskLists {
|
||||
);
|
||||
|
||||
if ( Features::is_enabled( 'core-profiler' ) ) {
|
||||
$key = array_search( 'StoreDetails', $tasks, true );
|
||||
if ( false !== $key ) {
|
||||
unset( $tasks[ $key ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old Personalize your store task if the new CustomizeStore is enabled.
|
||||
$task_to_remove = Features::is_enabled( 'customize-store' ) ? 'Appearance' : 'CustomizeStore';
|
||||
$store_customisation_task_index = array_search( $task_to_remove, $tasks, true );
|
||||
|
||||
if ( false !== $store_customisation_task_index ) {
|
||||
unset( $tasks[ $store_customisation_task_index ] );
|
||||
array_shift( $tasks );
|
||||
}
|
||||
|
||||
self::add_list(
|
||||
@@ -446,7 +431,7 @@ class TaskLists {
|
||||
|
||||
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
|
||||
if ( 0 === strpos( $menu_item[0], _x( 'Home', 'Admin menu name', 'woocommerce' ) ) ) {
|
||||
$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins remaining-tasks-badge woocommerce-task-list-remaining-tasks-badge"><span class="count-' . esc_attr( $tasks_count ) . '">' . absint( $tasks_count ) . '</span></span>'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins remaining-tasks-badge count-' . esc_attr( $tasks_count ) . '">' . number_format_i18n( $tasks_count ) . '</span>'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
||||
|
||||
/**
|
||||
* Customize Your Store Task
|
||||
*/
|
||||
class CustomizeStore extends Task {
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_id() {
|
||||
return 'customize-store';
|
||||
}
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
return __( 'Customize your store ', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_time() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Task completion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_complete() {
|
||||
return get_option( 'woocommerce_admin_customize_store_completed' ) === 'yes';
|
||||
}
|
||||
|
||||
/**
|
||||
* Task visibility.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_view() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_url() {
|
||||
return admin_url( 'wp-admin/admin.php?page=wc-admin&path=%2Fcustomize-store' );
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
||||
use Automattic\WooCommerce\Admin\PluginsHelper;
|
||||
use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\Init as Suggestions;
|
||||
use Automattic\WooCommerce\Internal\Admin\WCPayPromotion\Init as WCPayPromotionInit;
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList;
|
||||
|
||||
/**
|
||||
* WooCommercePayments Task
|
||||
@@ -73,13 +73,6 @@ class WooCommercePayments extends Task {
|
||||
* @return string
|
||||
*/
|
||||
public function get_additional_info() {
|
||||
if ( WCPayPromotionInit::is_woopay_eligible() ) {
|
||||
return __(
|
||||
'By using WooPayments you agree to be bound by our <a href="https://wordpress.com/tos/" target="_blank">Terms of Service</a> (including WooPay <a href="https://wordpress.com/tos/#more-woopay-specifically" target="_blank">merchant terms</a>) and acknowledge that you have read our <a href="https://automattic.com/privacy/" target="_blank">Privacy Policy</a>',
|
||||
'woocommerce'
|
||||
);
|
||||
}
|
||||
|
||||
return __(
|
||||
'By using WooPayments you agree to be bound by our <a href="https://wordpress.com/tos/" target="_blank">Terms of Service</a> and acknowledge that you have read our <a href="https://automattic.com/privacy/" target="_blank">Privacy Policy</a>',
|
||||
'woocommerce'
|
||||
@@ -109,7 +102,8 @@ class WooCommercePayments extends Task {
|
||||
|
||||
return ! $payments->is_complete() && // Do not re-display the task if the "add payments" task has already been completed.
|
||||
self::is_installed() &&
|
||||
self::is_supported();
|
||||
self::is_supported() &&
|
||||
! self::is_connected();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -904,7 +904,7 @@ class DefaultPaymentGateways {
|
||||
* @return array Array of countries.
|
||||
*/
|
||||
public static function get_wcpay_countries() {
|
||||
return array( 'US', 'PR', 'AU', 'CA', 'CY', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'IE', 'IT', 'LU', 'LT', 'LV', 'NO', 'NZ', 'MT', 'AT', 'BE', 'NL', 'PL', 'PT', 'CH', 'HK', 'SI', 'SK', 'SG', 'BG', 'CZ', 'HR', 'HU', 'RO', 'SE', 'JP', 'AE' );
|
||||
return array( 'US', 'PR', 'AU', 'CA', 'CY', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'IE', 'IT', 'LU', 'LT', 'LV', 'NO', 'NZ', 'MT', 'AT', 'BE', 'NL', 'PL', 'PT', 'CH', 'HK', 'SI', 'SK', 'SG', 'BG', 'CZ', 'HR', 'HU', 'RO', 'SE' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ class BlockRegistry {
|
||||
*/
|
||||
const PRODUCT_BLOCKS = [
|
||||
'woocommerce/conditional',
|
||||
'woocommerce/product-catalog-visibility-field',
|
||||
'woocommerce/product-category-field',
|
||||
'woocommerce/product-checkbox-field',
|
||||
'woocommerce/product-collapsible',
|
||||
@@ -42,10 +41,7 @@ class BlockRegistry {
|
||||
'woocommerce/product-tab',
|
||||
'woocommerce/product-inventory-quantity-field',
|
||||
'woocommerce/product-toggle-field',
|
||||
'woocommerce/product-variation-items-field',
|
||||
'woocommerce/product-variations-fields',
|
||||
'woocommerce/product-password-field',
|
||||
'woocommerce/product-has-variations-notice',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,10 +38,6 @@ class Init {
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( Features::is_enabled( 'product-variation-management' ) ) {
|
||||
array_push($this->supported_post_types, 'variable');
|
||||
}
|
||||
|
||||
$this->redirection_controller = new RedirectionController( $this->supported_post_types );
|
||||
|
||||
if ( \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'product_block_editor' ) ) {
|
||||
@@ -50,7 +46,6 @@ class Init {
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'dequeue_conflicting_styles' ), 100 );
|
||||
add_action( 'get_edit_post_link', array( $this, 'update_edit_product_link' ), 10, 2 );
|
||||
}
|
||||
add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_filter( 'woocommerce_register_post_type_product', array( $this, 'add_product_template' ) );
|
||||
|
||||
@@ -353,20 +348,11 @@ class Init {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-tab',
|
||||
array(
|
||||
'id' => 'organization',
|
||||
'title' => __( 'Organization', 'woocommerce' ),
|
||||
'order' => 15,
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
'title' => __( 'Product catalog', 'woocommerce' ),
|
||||
'title' => __( 'Organization & visibility', 'woocommerce' ),
|
||||
'description' => __( 'Help customers find this product by assigning it to categories or featuring it across your sales channels.', 'woocommerce' ),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
@@ -375,39 +361,18 @@ class Init {
|
||||
'name' => 'categories',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-catalog-visibility-field',
|
||||
array(
|
||||
'label' => __( 'Hide in product catalog', 'woocommerce' ),
|
||||
'visibilty' => 'search',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-catalog-visibility-field',
|
||||
array(
|
||||
'label' => __( 'Hide from search results', 'woocommerce' ),
|
||||
'visibilty' => 'catalog',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-checkbox-field',
|
||||
array(
|
||||
'label' => __( 'Enable product reviews', 'woocommerce' ),
|
||||
'property' => 'reviews_allowed',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-password-field',
|
||||
array(
|
||||
'label' => __( 'Require a password', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
'title' => __( 'Attributes', 'woocommerce' ),
|
||||
'title' => __( 'Attributes', 'woocommerce' ),
|
||||
'description' => sprintf(
|
||||
/* translators: %1$s: Attributes guide link opening tag. %2$s: Attributes guide link closing tag.*/
|
||||
__( 'Add descriptive pieces of information that customers can use to filter and search for this product. %1$sLearn more%2$s', 'woocommerce' ),
|
||||
'<a href="https://woocommerce.com/document/managing-product-taxonomies/#product-attributes" target="_blank" rel="noreferrer">',
|
||||
'</a>'
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
@@ -425,15 +390,6 @@ class Init {
|
||||
'order' => 20,
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'woocommerce/product-has-variations-notice',
|
||||
array(
|
||||
'id' => 'wc-product-notice-has-options',
|
||||
'content' => __( 'This product has options, such as size or color. You can now manage each variation\'s price and other details individually.', 'woocommerce' ),
|
||||
'buttonText' => __( 'Go to Variations', 'woocommerce' ),
|
||||
'type' => 'info',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
@@ -561,15 +517,6 @@ class Init {
|
||||
'order' => 30,
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'woocommerce/product-has-variations-notice',
|
||||
array(
|
||||
'id' => 'wc-product-notice-has-options',
|
||||
'content' => __( 'This product has options, such as size or color. You can now manage each variation\'s price and other details individually.', 'woocommerce' ),
|
||||
'buttonText' => __( 'Go to Variations', 'woocommerce' ),
|
||||
'type' => 'info',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
@@ -732,15 +679,6 @@ class Init {
|
||||
'order' => 40,
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'woocommerce/product-has-variations-notice',
|
||||
array(
|
||||
'id' => 'wc-product-notice-has-options',
|
||||
'content' => __( 'This product has options, such as size or color. You can now manage each variation\'s price and other details individually.', 'woocommerce' ),
|
||||
'buttonText' => __( 'Go to Variations', 'woocommerce' ),
|
||||
'type' => 'info',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
@@ -785,22 +723,7 @@ class Init {
|
||||
'</strong>'
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
'title' => __( 'Variation options', 'woocommerce' ),
|
||||
),
|
||||
array( array( 'woocommerce/product-variations-options-field' ) ),
|
||||
),
|
||||
array(
|
||||
'woocommerce/product-section',
|
||||
array(
|
||||
'title' => __( 'Variations', 'woocommerce' ),
|
||||
),
|
||||
array( array( 'woocommerce/product-variation-items-field' ) ),
|
||||
),
|
||||
),
|
||||
array(),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -810,22 +733,6 @@ class Init {
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds fields so that we can store user preferences for the variations block.
|
||||
*
|
||||
* @param array $user_data_fields User data fields.
|
||||
* @return array
|
||||
*/
|
||||
public function add_user_data_fields( $user_data_fields ) {
|
||||
return array_merge(
|
||||
$user_data_fields,
|
||||
array(
|
||||
'variable_product_block_tour_shown',
|
||||
'product_block_variable_options_notice_dismissed',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current screen to the block editor if a wc-admin page.
|
||||
*/
|
||||
|
||||
@@ -62,8 +62,7 @@ class RedirectionController {
|
||||
*/
|
||||
protected function is_product_supported( $product_id ): bool {
|
||||
$product = $product_id ? wc_get_product( $product_id ) : null;
|
||||
$digital_product = $product->is_downloadable() || $product->is_virtual();
|
||||
return $product && in_array( $product->get_type(), $this->supported_post_types, true ) && ! $digital_product;
|
||||
return $product && in_array( $product->get_type(), $this->supported_post_types, true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,14 +11,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
* Rule processor that negates the rules in the rule's operand.
|
||||
*/
|
||||
class NotRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The rule evaluator to use.
|
||||
*
|
||||
* @var RuleEvaluator
|
||||
*/
|
||||
protected $rule_evaluator;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -11,14 +11,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
* Rule processor for publishing based on the number of orders.
|
||||
*/
|
||||
class OrderCountRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The orders provider.
|
||||
*
|
||||
* @var OrdersProvider
|
||||
*/
|
||||
protected $orders_provider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,14 +13,6 @@ use Automattic\WooCommerce\Admin\PluginsProvider\PluginsProvider;
|
||||
* Rule processor for sending when the provided plugins are activated.
|
||||
*/
|
||||
class PluginsActivatedRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The plugins provider.
|
||||
*
|
||||
* @var PluginsProviderInterface
|
||||
*/
|
||||
protected $plugins_provider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,14 +13,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
* products.
|
||||
*/
|
||||
class ProductCountRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The product query.
|
||||
*
|
||||
* @var WC_Product_Query
|
||||
*/
|
||||
protected $product_query;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,14 +13,6 @@ use Automattic\WooCommerce\Admin\DateTimeProvider\CurrentDateTimeProvider;
|
||||
* Rule processor for sending after a specified date/time.
|
||||
*/
|
||||
class PublishAfterTimeRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The DateTime provider.
|
||||
*
|
||||
* @var DateTimeProviderInterface
|
||||
*/
|
||||
protected $date_time_provider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,14 +13,6 @@ use Automattic\WooCommerce\Admin\DateTimeProvider\CurrentDateTimeProvider;
|
||||
* Rule processor for sending before a specified date/time.
|
||||
*/
|
||||
class PublishBeforeTimeRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* The DateTime provider.
|
||||
*
|
||||
* @var DateTimeProviderInterface
|
||||
*/
|
||||
protected $date_time_provider;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,14 +13,6 @@ defined( 'ABSPATH' ) || exit;
|
||||
* given number of seconds.
|
||||
*/
|
||||
class WCAdminActiveForRuleProcessor implements RuleProcessorInterface {
|
||||
|
||||
/**
|
||||
* Provides the amount of time wcadmin has been active for.
|
||||
*
|
||||
* @var WCAdminActiveForProvider
|
||||
*/
|
||||
protected $wcadmin_active_for_provider;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@@ -20,28 +20,6 @@ if ( ! class_exists( 'WC_Email', false ) ) {
|
||||
* ReportCSVEmail Class.
|
||||
*/
|
||||
class ReportCSVEmail extends \WC_Email {
|
||||
|
||||
/**
|
||||
* Report labels.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $report_labels;
|
||||
|
||||
/**
|
||||
* Report type (e.g. 'customers').
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $report_type;
|
||||
|
||||
/**
|
||||
* Download URL.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $download_url;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user