rebase on oct-10-2023
This commit is contained in:
@@ -340,7 +340,7 @@ class WC_Admin_Addons {
|
||||
$url
|
||||
);
|
||||
|
||||
echo '<a href="' . esc_url( $url ) . '" class="add-new-h2">' . esc_html( $text ) . '</a>' . "\n";
|
||||
echo '<a href="' . esc_url( $url ) . '" class="page-title-action">' . esc_html( $text ) . '</a>' . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -641,7 +641,7 @@ class WC_Admin_Addons {
|
||||
|
||||
$defaults = array(
|
||||
'image' => WC()->plugin_url() . '/assets/images/wcpayments-icon-secure.png',
|
||||
'image_alt' => __( 'WooCommerce Payments', 'woocommerce' ),
|
||||
'image_alt' => __( 'WooPayments', 'woocommerce' ),
|
||||
'title' => __( 'Payments made simple, with no monthly fees — exclusively for WooCommerce stores.', 'woocommerce' ),
|
||||
'description' => __( 'Securely accept cards in your store. See payments, track cash flow into your bank account, and stay on top of disputes – right from your dashboard.', 'woocommerce' ),
|
||||
'button' => __( 'Free - Install now', 'woocommerce' ),
|
||||
@@ -1119,7 +1119,7 @@ class WC_Admin_Addons {
|
||||
/**
|
||||
* Install WooCommerce Payments from the Extensions screens.
|
||||
*
|
||||
* @param string $section Optional. Extenstions tab.
|
||||
* @param string $section Optional. Extensions tab.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -1128,7 +1128,7 @@ class WC_Admin_Addons {
|
||||
|
||||
$wcpay_plugin_id = 'woocommerce-payments';
|
||||
$wcpay_plugin = array(
|
||||
'name' => __( 'WooCommerce Payments', 'woocommerce' ),
|
||||
'name' => __( 'WooPayments', 'woocommerce' ),
|
||||
'repo-slug' => 'woocommerce-payments',
|
||||
);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class WC_Admin_API_Keys_Table_List extends WP_List_Table {
|
||||
* @return string
|
||||
*/
|
||||
public function column_truncated_key( $key ) {
|
||||
return '<code>…' . esc_html( $key['truncated_key'] ) . '</code>';
|
||||
return '<code>***' . esc_html( $key['truncated_key'] ) . '</code>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ class WC_Admin_API_Keys {
|
||||
private static function table_list_output() {
|
||||
global $wpdb, $keys_table_list;
|
||||
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'REST API', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&create-key=1' ) ) . '" class="add-new-h2">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'REST API', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&create-key=1' ) ) . '" class="page-title-action">' . esc_html__( 'Add key', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the API keys count.
|
||||
$count = $wpdb->get_var( "SELECT COUNT(key_id) FROM {$wpdb->prefix}woocommerce_api_keys WHERE 1 = 1;" );
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Admin\Features\Features;
|
||||
use Automattic\WooCommerce\Internal\Admin\WCAdminAssets;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
@@ -71,6 +72,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
if ( ! isset( $args['has_rtl'] ) ) {
|
||||
wp_style_add_data( $handle, 'rtl', 'replace' );
|
||||
}
|
||||
|
||||
wp_enqueue_style( $handle );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,6 +200,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
wp_enqueue_script( 'iris' );
|
||||
wp_enqueue_script( 'woocommerce_admin' );
|
||||
wp_enqueue_script( 'wc-enhanced-select' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
||||
|
||||
@@ -222,10 +226,10 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
'export_products' => __( 'Export', 'woocommerce' ),
|
||||
),
|
||||
'nonces' => array(
|
||||
'gateway_toggle' => wp_create_nonce( 'woocommerce-toggle-payment-gateway-enabled' ),
|
||||
'gateway_toggle' => current_user_can( 'manage_woocommerce' ) ? wp_create_nonce( 'woocommerce-toggle-payment-gateway-enabled' ) : null,
|
||||
),
|
||||
'urls' => array(
|
||||
'add_product' => Features::is_enabled( 'new-product-management-experience' ) || Features::is_enabled( 'product-block-editor' ) ? esc_url_raw( admin_url( 'admin.php?page=wc-admin&path=/add-product' ) ) : null,
|
||||
'add_product' => Features::is_enabled( 'new-product-management-experience' ) || \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'product_block_editor' ) ? esc_url_raw( admin_url( 'admin.php?page=wc-admin&path=/add-product' ) ) : null,
|
||||
'import_products' => current_user_can( 'import' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ) : null,
|
||||
'export_products' => current_user_can( 'export' ) ? esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ) : null,
|
||||
),
|
||||
@@ -295,14 +299,13 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
'i18n_last_warning' => esc_js( __( 'Last warning, are you sure?', 'woocommerce' ) ),
|
||||
'i18n_choose_image' => esc_js( __( 'Choose an image', 'woocommerce' ) ),
|
||||
'i18n_set_image' => esc_js( __( 'Set variation image', 'woocommerce' ) ),
|
||||
'i18n_variation_added' => esc_js( __( 'variation added', 'woocommerce' ) ),
|
||||
'i18n_variations_added' => esc_js( __( 'variations added', 'woocommerce' ) ),
|
||||
'i18n_no_variations_added' => esc_js( __( 'No variations added', 'woocommerce' ) ),
|
||||
'i18n_variation_added' => esc_js( __( '1 variation added', 'woocommerce' ) ),
|
||||
'i18n_variations_added' => esc_js( __( '%qty% variations added', 'woocommerce' ) ),
|
||||
'i18n_remove_variation' => esc_js( __( 'Are you sure you want to remove this variation?', 'woocommerce' ) ),
|
||||
'i18n_scheduled_sale_start' => esc_js( __( 'Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||
'i18n_scheduled_sale_end' => esc_js( __( 'Sale end date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||
'i18n_edited_variations' => esc_js( __( 'Save changes before changing page?', 'woocommerce' ) ),
|
||||
'i18n_variation_count_single' => esc_js( __( '%qty% variation', 'woocommerce' ) ),
|
||||
'i18n_variation_count_single' => esc_js( __( '1 variation', 'woocommerce' ) ),
|
||||
'i18n_variation_count_plural' => esc_js( __( '%qty% variations', 'woocommerce' ) ),
|
||||
'variations_per_page' => absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) ),
|
||||
);
|
||||
@@ -373,7 +376,6 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
'i18n_delete_refund' => __( 'Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce' ),
|
||||
'i18n_delete_tax' => __( 'Are you sure you wish to delete this tax column? This action cannot be undone.', 'woocommerce' ),
|
||||
'remove_item_meta' => __( 'Remove this item meta?', 'woocommerce' ),
|
||||
'remove_attribute' => __( 'Remove this attribute?', 'woocommerce' ),
|
||||
'name_label' => __( 'Name', 'woocommerce' ),
|
||||
'remove_label' => __( 'Remove', 'woocommerce' ),
|
||||
'click_to_toggle' => __( 'Click to toggle', 'woocommerce' ),
|
||||
@@ -415,7 +417,6 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
'rounding_precision' => wc_get_rounding_precision(),
|
||||
'tax_rounding_mode' => wc_get_tax_rounding_mode(),
|
||||
'product_types' => array_unique( array_merge( array( 'simple', 'grouped', 'variable', 'external' ), array_keys( wc_get_product_types() ) ) ),
|
||||
'has_local_attributes' => ! empty( wc_get_attribute_taxonomies() ),
|
||||
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),
|
||||
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
|
||||
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
|
||||
@@ -434,6 +435,7 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
|
||||
/* translators: %1$s: maximum file size */
|
||||
'i18n_product_image_tip' => sprintf( __( 'For best results, upload JPEG or PNG files that are 1000 by 1000 pixels or larger. Maximum upload file size: %1$s.', 'woocommerce' ) , size_format( wp_max_upload_size() ) ),
|
||||
'i18n_remove_used_attribute_confirmation_message' => __( 'If you remove this attribute, customers will no longer be able to purchase some variations of this product.', 'woocommerce' ),
|
||||
'i18n_add_attribute_error_notice' => __( 'Adding new attribute failed.', 'woocommerce' ),
|
||||
);
|
||||
|
||||
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );
|
||||
|
||||
@@ -91,7 +91,7 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
|
||||
* @return string
|
||||
*/
|
||||
public function get_button_link( $task ) {
|
||||
$url = $task->get_json()['actionUrl'];
|
||||
$url = (string) $task->get_json()['actionUrl'];
|
||||
|
||||
if ( substr( $url, 0, 4 ) === 'http' ) {
|
||||
return $url;
|
||||
|
||||
@@ -290,13 +290,14 @@ class WC_Admin_Importers {
|
||||
// Send success.
|
||||
wp_send_json_success(
|
||||
array(
|
||||
'position' => 'done',
|
||||
'percentage' => 100,
|
||||
'url' => add_query_arg( array( '_wpnonce' => wp_create_nonce( 'woocommerce-csv-importer' ) ), admin_url( 'edit.php?post_type=product&page=product_importer&step=done' ) ),
|
||||
'imported' => count( $results['imported'] ),
|
||||
'failed' => count( $results['failed'] ),
|
||||
'updated' => count( $results['updated'] ),
|
||||
'skipped' => count( $results['skipped'] ),
|
||||
'position' => 'done',
|
||||
'percentage' => 100,
|
||||
'url' => add_query_arg( array( '_wpnonce' => wp_create_nonce( 'woocommerce-csv-importer' ) ), admin_url( 'edit.php?post_type=product&page=product_importer&step=done' ) ),
|
||||
'imported' => count( $results['imported'] ),
|
||||
'imported_variations' => count( $results['imported_variations'] ),
|
||||
'failed' => count( $results['failed'] ),
|
||||
'updated' => count( $results['updated'] ),
|
||||
'skipped' => count( $results['skipped'] ),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -319,8 +319,7 @@ class WC_Admin_Menus {
|
||||
*/
|
||||
public function orders_menu(): void {
|
||||
if ( wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled() ) {
|
||||
$this->orders_page_controller = new Custom_Orders_PageController();
|
||||
$this->orders_page_controller->setup();
|
||||
wc_get_container()->get( Custom_Orders_PageController::class )->setup();
|
||||
} else {
|
||||
wc_get_container()->get( COTRedirectionController::class )->setup();
|
||||
}
|
||||
@@ -427,7 +426,7 @@ class WC_Admin_Menus {
|
||||
* Maybe add new management product experience.
|
||||
*/
|
||||
public function maybe_add_new_product_management_experience() {
|
||||
if ( Features::is_enabled( 'new-product-management-experience' ) || Features::is_enabled( 'product-block-editor' ) ) {
|
||||
if ( Features::is_enabled( 'new-product-management-experience' ) || \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'product_block_editor' ) ) {
|
||||
global $submenu;
|
||||
if ( isset( $submenu['edit.php?post_type=product'][10] ) ) {
|
||||
// Disable phpcs since we need to override submenu classes.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
use Automattic\WooCommerce\Internal\Admin\Orders\Edit as OrderEdit;
|
||||
use Automattic\WooCommerce\Utilities\OrderUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
@@ -215,7 +216,7 @@ class WC_Admin_Meta_Boxes {
|
||||
$post_id = absint( $post_id );
|
||||
|
||||
// $post_id and $post are required
|
||||
if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
|
||||
if ( empty( $post_id ) || empty( $post ) || ! is_a( $post, 'WP_Post' ) || self::$saved_meta_boxes ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,6 +248,10 @@ class WC_Admin_Meta_Boxes {
|
||||
|
||||
// Check the post type.
|
||||
if ( in_array( $post->post_type, wc_get_order_types( 'order-meta-boxes' ), true ) ) {
|
||||
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save meta for shop order.
|
||||
*
|
||||
|
||||
@@ -57,6 +57,7 @@ class WC_Admin_Notices {
|
||||
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
|
||||
add_action( 'wp_loaded', array( __CLASS__, 'add_redirect_download_method_notice' ) );
|
||||
add_action( 'admin_init', array( __CLASS__, 'hide_notices' ), 20 );
|
||||
self::add_action( 'admin_init', array( __CLASS__, 'maybe_remove_php74_required_notice' ) );
|
||||
|
||||
// @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation.
|
||||
// That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want
|
||||
@@ -119,8 +120,53 @@ class WC_Admin_Notices {
|
||||
self::add_notice( 'template_files' );
|
||||
self::add_min_version_notice();
|
||||
self::add_maxmind_missing_license_key_notice();
|
||||
self::maybe_add_php74_required_notice();
|
||||
}
|
||||
|
||||
// phpcs:disable Generic.Commenting.Todo.TaskFound
|
||||
|
||||
/**
|
||||
* Add an admin notice about the bump of the required PHP version in WooCommerce 8.2
|
||||
* if the current PHP version is too old.
|
||||
*
|
||||
* TODO: Remove this method in WooCommerce 8.2.
|
||||
*/
|
||||
private static function maybe_add_php74_required_notice() {
|
||||
if ( version_compare( phpversion(), '7.4', '>=' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::add_custom_notice(
|
||||
'php74_required_in_woo_82',
|
||||
sprintf(
|
||||
'%s%s',
|
||||
sprintf(
|
||||
'<h4>%s</h4>',
|
||||
esc_html__( 'PHP version requirements will change soon', 'woocommerce' )
|
||||
),
|
||||
sprintf(
|
||||
// translators: Placeholder is a URL.
|
||||
wpautop( wp_kses_data( __( 'WooCommerce 8.2, scheduled for <b>October 2023</b>, will require PHP 7.4 or newer to work. Your server is currently running an older version of PHP, so this change will impact your store. Upgrading to at least PHP 8.0 is recommended. <b><a href="%s">Learn more about this change.</a></b>', 'woocommerce' ) ) ),
|
||||
'https://developer.woocommerce.com/2023/06/05/new-requirement-for-woocommerce-8-2-php-7-4/'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the admin notice about the bump of the required PHP version in WooCommerce 8.2
|
||||
* if the current PHP version is good.
|
||||
*
|
||||
* TODO: Remove this method in WooCommerce 8.2.
|
||||
*/
|
||||
private static function maybe_remove_php74_required_notice() {
|
||||
if ( version_compare( phpversion(), '7.4', '>=' ) && self::has_notice( 'php74_required_in_woo_82' ) ) {
|
||||
self::remove_notice( 'php74_required_in_woo_82' );
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:enable Generic.Commenting.Todo.TaskFound
|
||||
|
||||
/**
|
||||
* Show a notice.
|
||||
*
|
||||
|
||||
@@ -985,7 +985,7 @@ class WC_Admin_Post_Types {
|
||||
break;
|
||||
}
|
||||
$regular_price = $product->get_regular_price();
|
||||
if ( $is_percentage ) {
|
||||
if ( $is_percentage && is_numeric( $regular_price ) ) {
|
||||
$percent = $price / 100;
|
||||
$new_price = max( 0, $regular_price - ( NumberUtil::round( $regular_price * $percent, wc_get_price_decimals() ) ) );
|
||||
} else {
|
||||
|
||||
@@ -429,8 +429,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
|
||||
// Radio inputs.
|
||||
case 'radio':
|
||||
$option_value = $value['value'];
|
||||
$disabled_values = $value['disabled'] ?? array();
|
||||
$option_value = $value['value'];
|
||||
$disabled_values = $value['disabled'] ?? array();
|
||||
$show_desc_at_end = $value['desc_at_end'] ?? false;
|
||||
|
||||
?>
|
||||
<tr valign="top">
|
||||
@@ -439,7 +440,11 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
</th>
|
||||
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
|
||||
<fieldset>
|
||||
<?php echo $description; // WPCS: XSS ok. ?>
|
||||
<?php
|
||||
if ( ! $show_desc_at_end ) {
|
||||
echo wp_kses_post( $description );
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<?php
|
||||
foreach ( $value['options'] as $key => $val ) {
|
||||
@@ -458,6 +463,9 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
if ( $show_desc_at_end ) {
|
||||
echo wp_kses_post( "<p class='description description-thin'>{$description}</p>" );
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
@@ -362,7 +362,7 @@ class WC_Admin_Status {
|
||||
<?php
|
||||
echo esc_html(
|
||||
sprintf(
|
||||
// translators: Comma seperated list of missing tables.
|
||||
// translators: Comma separated list of missing tables.
|
||||
__( 'Missing base tables: %s. Some WooCommerce functionality may not work as expected.', 'woocommerce' ),
|
||||
implode( ', ', $missing_tables )
|
||||
)
|
||||
|
||||
@@ -295,7 +295,7 @@ class WC_Admin_Webhooks {
|
||||
private static function table_list_output() {
|
||||
global $webhooks_table_list;
|
||||
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ) . '" class="add-new-h2">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
echo '<h2 class="wc-table-list-header">' . esc_html__( 'Webhooks', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&edit-webhook=0' ) ) . '" class="page-title-action">' . esc_html__( 'Add webhook', 'woocommerce' ) . '</a></h2>';
|
||||
|
||||
// Get the webhooks count.
|
||||
$data_store = WC_Data_Store::load( 'webhook' );
|
||||
|
||||
@@ -28,7 +28,6 @@ class WC_Admin {
|
||||
add_action( 'admin_init', array( $this, 'admin_redirects' ) );
|
||||
add_action( 'admin_footer', 'wc_print_js', 25 );
|
||||
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
|
||||
add_action( 'init', array( 'WC_Site_Tracking', 'init' ) );
|
||||
|
||||
// Disable WXR export of schedule action posts.
|
||||
add_filter( 'action_scheduler_post_type_args', array( $this, 'disable_webhook_post_export' ) );
|
||||
@@ -67,12 +66,6 @@ class WC_Admin {
|
||||
include_once __DIR__ . '/class-wc-admin-importers.php';
|
||||
include_once __DIR__ . '/class-wc-admin-exporters.php';
|
||||
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks.php';
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-event.php';
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-client.php';
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-tracks-footer-pixel.php';
|
||||
include_once WC_ABSPATH . 'includes/tracks/class-wc-site-tracking.php';
|
||||
|
||||
// Help Tabs.
|
||||
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) ) {
|
||||
include_once __DIR__ . '/class-wc-admin-help.php';
|
||||
@@ -157,7 +150,19 @@ class WC_Admin {
|
||||
public function prevent_admin_access() {
|
||||
$prevent_access = false;
|
||||
|
||||
if ( apply_filters( 'woocommerce_disable_admin_bar', true ) && ! wp_doing_ajax() && isset( $_SERVER['SCRIPT_FILENAME'] ) && basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ) !== 'admin-post.php' ) {
|
||||
// Do not interfere with admin-post or admin-ajax requests.
|
||||
$exempted_paths = array( 'admin-post.php', 'admin-ajax.php' );
|
||||
|
||||
if (
|
||||
/**
|
||||
* This filter is documented in ../wc-user-functions.php
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
apply_filters( 'woocommerce_disable_admin_bar', true )
|
||||
&& isset( $_SERVER['SCRIPT_FILENAME'] )
|
||||
&& ! in_array( basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_FILENAME'] ) ) ), $exempted_paths, true )
|
||||
) {
|
||||
$has_cap = false;
|
||||
$access_caps = array( 'edit_posts', 'manage_woocommerce', 'view_admin_dashboard' );
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ class WC_Helper_Updater {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translations updates informations.
|
||||
* Get translations updates information.
|
||||
*
|
||||
* Scans through all subscriptions for the connected user, as well
|
||||
* as all Woo extensions without a subscription, and obtains update
|
||||
@@ -226,7 +226,7 @@ class WC_Helper_Updater {
|
||||
$locales = apply_filters( 'plugins_update_check_locales', $locales );
|
||||
$locales = array_unique( $locales );
|
||||
|
||||
// No locales, the respone will be empty, we can return now.
|
||||
// No locales, the response will be empty, we can return now.
|
||||
if ( empty( $locales ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
$class_html = $current_filter === $key ? 'class="current"' : '';
|
||||
?>
|
||||
<li>
|
||||
<a <?php echo esc_html( $class_html ); ?> href="<?php echo esc_url( $url ); ?>">
|
||||
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<a <?php echo $class_html; ?> href="<?php echo esc_url( $url ); ?>">
|
||||
<?php echo esc_html( $label ); ?>
|
||||
<span class="count">(<?php echo absint( $counts[ $key ] ); ?>)</span>
|
||||
</a>
|
||||
|
||||
@@ -461,12 +461,13 @@ class WC_Product_CSV_Importer_Controller {
|
||||
*/
|
||||
protected function done() {
|
||||
check_admin_referer( 'woocommerce-csv-importer' );
|
||||
$imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0;
|
||||
$updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0;
|
||||
$failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0;
|
||||
$skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0;
|
||||
$file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : '';
|
||||
$errors = array_filter( (array) get_user_option( 'product_import_error_log' ) );
|
||||
$imported = isset( $_GET['products-imported'] ) ? absint( $_GET['products-imported'] ) : 0;
|
||||
$imported_variations = isset( $_GET['products-imported-variations'] ) ? absint( $_GET['products-imported-variations'] ) : 0;
|
||||
$updated = isset( $_GET['products-updated'] ) ? absint( $_GET['products-updated'] ) : 0;
|
||||
$failed = isset( $_GET['products-failed'] ) ? absint( $_GET['products-failed'] ) : 0;
|
||||
$skipped = isset( $_GET['products-skipped'] ) ? absint( $_GET['products-skipped'] ) : 0;
|
||||
$file_name = isset( $_GET['file-name'] ) ? sanitize_text_field( wp_unslash( $_GET['file-name'] ) ) : '';
|
||||
$errors = array_filter( (array) get_user_option( 'product_import_error_log' ) );
|
||||
|
||||
include_once dirname( __FILE__ ) . '/views/html-csv-import-done.php';
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function wc_importer_current_locale() {
|
||||
* @return array
|
||||
*/
|
||||
function wc_importer_default_english_mappings( $mappings ) {
|
||||
if ( 'en_US' === wc_importer_current_locale() ) {
|
||||
if ( 'en_US' === wc_importer_current_locale() && is_array( $mappings ) && count( $mappings ) > 0 ) {
|
||||
return $mappings;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ add_filter( 'woocommerce_csv_product_import_mapping_default_columns', 'wc_import
|
||||
* @return array
|
||||
*/
|
||||
function wc_importer_default_special_english_mappings( $mappings ) {
|
||||
if ( 'en_US' === wc_importer_current_locale() ) {
|
||||
if ( 'en_US' === wc_importer_current_locale() && is_array( $mappings ) && count( $mappings ) > 0 ) {
|
||||
return $mappings;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( 0 < $imported_variations ) {
|
||||
$results[] = sprintf(
|
||||
/* translators: %d: products count */
|
||||
_n( '%s variations imported', '%s variations imported', $imported_variations, 'woocommerce' ),
|
||||
'<strong>' . number_format_i18n( $imported_variations ) . '</strong>'
|
||||
);
|
||||
}
|
||||
|
||||
if ( 0 < $skipped ) {
|
||||
$results[] = sprintf(
|
||||
/* translators: %d: products count */
|
||||
|
||||
@@ -646,11 +646,11 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
||||
public function search_custom_fields( $wp ) {
|
||||
global $pagenow;
|
||||
|
||||
if ( 'edit.php' !== $pagenow || empty( $wp->query_vars['s'] ) || 'shop_order' !== $wp->query_vars['post_type'] || ! isset( $_GET['s'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( 'edit.php' !== $pagenow || 'shop_order' !== $wp->query_vars['post_type'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return;
|
||||
}
|
||||
|
||||
$post_ids = wc_order_search( wc_clean( wp_unslash( $_GET['s'] ) ) ); // WPCS: input var ok, sanitization ok.
|
||||
$post_ids = isset( $_GET['s'] ) && ! empty( $wp->query_vars['s'] ) ? wc_order_search( wc_clean( wp_unslash( $_GET['s'] ) ) ) : array(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
if ( ! empty( $post_ids ) ) {
|
||||
// Remove "s" - we don't want to search order name.
|
||||
@@ -662,5 +662,23 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
|
||||
// Search by found posts.
|
||||
$wp->query_vars['post__in'] = array_merge( $post_ids, array( 0 ) );
|
||||
}
|
||||
|
||||
if ( isset( $_GET['order_date_type'] ) && isset( $_GET['m'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$date_type = wc_clean( wp_unslash( $_GET['order_date_type'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$date_query = wc_clean( wp_unslash( $_GET['m'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
// date_paid and date_completed are stored in postmeta, so we need to do a meta query.
|
||||
if ( 'date_paid' === $date_type || 'date_completed' === $date_type ) {
|
||||
$date_start = \DateTime::createFromFormat( 'Ymd H:i:s', "$date_query 00:00:00" );
|
||||
$date_end = \DateTime::createFromFormat( 'Ymd H:i:s', "$date_query 23:59:59" );
|
||||
|
||||
unset( $wp->query_vars['m'] );
|
||||
|
||||
if ( $date_start && $date_end ) {
|
||||
$wp->query_vars['meta_key'] = "_$date_type"; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
|
||||
$wp->query_vars['meta_value'] = array( strval( $date_start->getTimestamp() ), strval( $date_end->getTimestamp() ) ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
|
||||
$wp->query_vars['meta_compare'] = 'BETWEEN';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +250,21 @@ class WC_Meta_Box_Order_Data {
|
||||
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
/**
|
||||
* Hook allowing extenders to render custom content
|
||||
* within the Order details box.
|
||||
*
|
||||
* This allows urgent notices or other important
|
||||
* order-related info to be displayed upfront in
|
||||
* the order page. Example: display a notice if
|
||||
* the order is disputed.
|
||||
*
|
||||
* @param $order WC_Order The order object being displayed.
|
||||
* @since 7.9.0
|
||||
*/
|
||||
do_action( 'woocommerce_admin_order_data_after_payment_info', $order );
|
||||
?>
|
||||
<div class="order_data_column_container">
|
||||
<div class="order_data_column">
|
||||
<h3><?php esc_html_e( 'General', 'woocommerce' ); ?></h3>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Product Categories meta box
|
||||
*
|
||||
* Display the product categories meta box.
|
||||
*
|
||||
* @package WooCommerce\Admin\Meta Boxes
|
||||
* @version 7.5.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Meta_Box_Product_Categories Class.
|
||||
*/
|
||||
class WC_Meta_Box_Product_Categories {
|
||||
|
||||
/**
|
||||
* Output the metabox.
|
||||
*
|
||||
* @param WP_Post $post Current post object.
|
||||
* @param array $box {
|
||||
* Categories meta box arguments.
|
||||
*
|
||||
* @type string $id Meta box 'id' attribute.
|
||||
* @type string $title Meta box title.
|
||||
* @type callable $callback Meta box display callback.
|
||||
* @type array $args {
|
||||
* Extra meta box arguments.
|
||||
*
|
||||
* @type string $taxonomy Taxonomy. Default 'category'.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
public static function output( $post, $box ) {
|
||||
$categories_count = (int) wp_count_terms( 'product_cat' );
|
||||
|
||||
/**
|
||||
* Filters the category metabox search threshold, for when to render the typeahead field.
|
||||
*
|
||||
* @since 7.6.0
|
||||
*
|
||||
* @param number $threshold The default threshold.
|
||||
* @returns number The threshold that will be used.
|
||||
*/
|
||||
if ( $categories_count <= apply_filters( 'woocommerce_product_category_metabox_search_threshold', 100 ) && function_exists( 'post_categories_meta_box' ) ) {
|
||||
return post_categories_meta_box( $post, $box );
|
||||
}
|
||||
|
||||
$defaults = array( 'taxonomy' => 'category' );
|
||||
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
|
||||
$args = array();
|
||||
} else {
|
||||
$args = $box['args'];
|
||||
}
|
||||
$parsed_args = wp_parse_args( $args, $defaults );
|
||||
$tax_name = $parsed_args['taxonomy'];
|
||||
$selected_categories = wp_get_object_terms( $post->ID, 'product_cat' );
|
||||
?>
|
||||
<div id="taxonomy-<?php echo esc_attr( $tax_name ); ?>-metabox"></div>
|
||||
<?php foreach ( (array) $selected_categories as $term ) { ?>
|
||||
<input
|
||||
type="hidden"
|
||||
value="<?php echo esc_attr( $term->term_id ); ?>"
|
||||
name="tax_input[<?php esc_attr( $tax_name ); ?>][]"
|
||||
data-name="<?php echo esc_attr( $term->name ); ?>"
|
||||
/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,22 +56,7 @@ class WC_Meta_Box_Product_Data {
|
||||
/* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */
|
||||
return apply_filters(
|
||||
'product_type_options',
|
||||
array(
|
||||
'virtual' => array(
|
||||
'id' => '_virtual',
|
||||
'wrapper_class' => 'show_if_simple',
|
||||
'label' => __( 'Virtual', 'woocommerce' ),
|
||||
'description' => __( 'Virtual products are intangible and are not shipped.', 'woocommerce' ),
|
||||
'default' => 'no',
|
||||
),
|
||||
'downloadable' => array(
|
||||
'id' => '_downloadable',
|
||||
'wrapper_class' => 'show_if_simple',
|
||||
'label' => __( 'Downloadable', 'woocommerce' ),
|
||||
'description' => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
|
||||
'default' => 'no',
|
||||
),
|
||||
)
|
||||
wc_get_default_product_type_options(),
|
||||
);
|
||||
/* phpcs: enable */
|
||||
}
|
||||
@@ -186,14 +171,12 @@ class WC_Meta_Box_Product_Data {
|
||||
global $post, $wpdb, $product_object;
|
||||
|
||||
/* phpcs:disable WooCommerce.Commenting.CommentHooks.MissingHookComment */
|
||||
$global_attributes_count = count( wc_get_attribute_taxonomies() );
|
||||
$variation_attributes = array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_variation_attributes' ) );
|
||||
$non_variation_attributes_count = count( array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_non_variation_attributes' ) ) );
|
||||
$default_attributes = $product_object->get_default_attributes();
|
||||
$variations_count = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID ) ), $post->ID ) );
|
||||
$variations_per_page = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
|
||||
$variations_total_pages = ceil( $variations_count / $variations_per_page );
|
||||
$modal_title = get_bloginfo( 'name' ) . __( ' says', 'woocommerce' );
|
||||
$variation_attributes = array_filter( $product_object->get_attributes(), array( __CLASS__, 'filter_variation_attributes' ) );
|
||||
$default_attributes = $product_object->get_default_attributes();
|
||||
$variations_count = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_count', $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID ) ), $post->ID ) );
|
||||
$variations_per_page = absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 15 ) );
|
||||
$variations_total_pages = ceil( $variations_count / $variations_per_page );
|
||||
$modal_title = get_bloginfo( 'name' ) . __( ' says', 'woocommerce' );
|
||||
/* phpcs: enable */
|
||||
|
||||
include __DIR__ . '/views/html-product-data-variations.php';
|
||||
|
||||
@@ -93,28 +93,19 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
<tr>
|
||||
<td>
|
||||
<div class="enable_variation show_if_variable">
|
||||
<label><input type="checkbox" class="woocommerce_attribute_used_for_variations checkbox" <?php checked( $attribute->get_variation(), true ); ?> <?php echo esc_attr( isset( $is_variations_screen ) ? 'disabled' : '' ); ?> name="attribute_variation[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Used for variations', 'woocommerce' ); ?></label>
|
||||
<?php
|
||||
if ( isset( $is_variations_screen ) ) {
|
||||
?>
|
||||
<input type="hidden" name="attribute_variation[<?php echo esc_attr( $i ); ?>]" value="1" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<label><input type="checkbox" class="woocommerce_attribute_used_for_variations checkbox" <?php checked( $attribute->get_variation(), true ); ?> name="attribute_variation[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Used for variations', 'woocommerce' ); ?></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ( ! isset( $is_variations_screen ) ) {
|
||||
/**
|
||||
* Hook to display custom attribute terms.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @param WC_Product_Attribute $attribute Attribute object.
|
||||
* @param number $i Attribute index.
|
||||
*/
|
||||
do_action( 'woocommerce_after_product_attribute_settings', $attribute, $i );
|
||||
}
|
||||
/**
|
||||
* Hook to display custom attribute terms.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @param WC_Product_Attribute $attribute Attribute object.
|
||||
* @param number $i Attribute index.
|
||||
*/
|
||||
do_action( 'woocommerce_after_product_attribute_settings', $attribute, $i );
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -13,78 +13,27 @@ global $wc_product_attributes;
|
||||
// Array of defined attribute taxonomies.
|
||||
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
||||
// Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set.
|
||||
$product_attributes = $product_object->get_attributes( 'edit' );
|
||||
$has_local_attributes = empty( $attribute_taxonomies );
|
||||
$has_global_attributes = empty( $product_attributes );
|
||||
$is_add_global_attribute_visible = ! $has_local_attributes && $has_global_attributes;
|
||||
$icon_url = WC_ADMIN_IMAGES_FOLDER_URL . '/icons/global-attributes-icon.svg';
|
||||
$product_attributes = $product_object->get_attributes( 'edit' );
|
||||
?>
|
||||
<div id="product_attributes" class="panel wc-metaboxes-wrapper hidden">
|
||||
<div class="toolbar toolbar-top <?php echo $is_add_global_attribute_visible ? ' expand-close-hidden' : ''; ?>">
|
||||
<div class="add-global-attribute-container<?php echo $is_add_global_attribute_visible ? '' : ' hidden'; ?>">
|
||||
<div class="actions">
|
||||
<button type="button" class="button add_custom_attribute"><?php esc_html_e( 'Add new', 'woocommerce' ); ?></button>
|
||||
<select class="wc-attribute-search" data-placeholder="<?php esc_attr_e( 'Add existing', 'woocommerce' ); ?>" data-minimum-input-length="0">
|
||||
</select>
|
||||
</div>
|
||||
<div class="message">
|
||||
<img src="<?php echo esc_url( $icon_url ); ?>" />
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Add descriptive pieces of information that customers can use to search for this product on your store, such as “Material” or “Brand”.',
|
||||
'woocommerce'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-attribute-container<?php echo $is_add_global_attribute_visible ? ' hidden' : ' '; ?>">
|
||||
<?php
|
||||
if ( $has_local_attributes && $has_global_attributes ) :
|
||||
?>
|
||||
<div id="message" class="inline notice woocommerce-message">
|
||||
<p>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'Add descriptive pieces of information that customers can use to search for this product on your store, such as “Material” or “Brand”.',
|
||||
'woocommerce'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<span class="expand-close">
|
||||
<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
|
||||
</span>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Filter for the attribute taxonomy filter dropdown threshold.
|
||||
*
|
||||
* @since 7.0.0
|
||||
* @param number $threshold The threshold for showing the simple dropdown.
|
||||
*/
|
||||
if ( count( $attribute_taxonomies ) <= apply_filters( 'woocommerce_attribute_taxonomy_filter_threshold', 20 ) ) :
|
||||
?>
|
||||
<select name="attribute_taxonomy" class="attribute_taxonomy">
|
||||
<option value=""><?php esc_html_e( 'Custom product attribute', 'woocommerce' ); ?></option>
|
||||
<div class="toolbar toolbar-top">
|
||||
<div id="message" class="inline notice woocommerce-message">
|
||||
<p>
|
||||
<?php
|
||||
if ( ! $has_local_attributes ) {
|
||||
foreach ( $attribute_taxonomies as $attr_taxonomy ) {
|
||||
$attribute_taxonomy_name = wc_attribute_taxonomy_name( $attr_taxonomy->attribute_name );
|
||||
$label = $attr_taxonomy->attribute_label ? $attr_taxonomy->attribute_label : $attr_taxonomy->attribute_name;
|
||||
echo '<option value="' . esc_attr( $attribute_taxonomy_name ) . '">' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
}
|
||||
esc_html_e(
|
||||
'Add descriptive pieces of information that customers can use to search for this product on your store, such as “Material” or “Brand”.',
|
||||
'woocommerce'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<span class="expand-close">
|
||||
<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
|
||||
</span>
|
||||
<div class="actions">
|
||||
<button type="button" class="button add_custom_attribute"><?php esc_html_e( 'Add new', 'woocommerce' ); ?></button>
|
||||
<select class="wc-attribute-search" data-placeholder="<?php esc_attr_e( 'Add existing', 'woocommerce' ); ?>" data-minimum-input-length="0">
|
||||
</select>
|
||||
<button type="button" class="button add_attribute"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
|
||||
<?php else : ?>
|
||||
<button type="button" class="button add_custom_attribute"><?php esc_html_e( 'Add custom attribute', 'woocommerce' ); ?></button>
|
||||
<select class="wc-attribute-search attribute_taxonomy" id="attribute_taxonomy" name="attribute_taxonomy" data-placeholder="<?php esc_attr_e( 'Add existing attribute', 'woocommerce' ); ?>" data-minimum-input-length="0">
|
||||
</select>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product_attributes wc-metaboxes">
|
||||
@@ -104,7 +53,7 @@ $icon_url = WC_ADMIN_IMAGES_FOLDER_URL . '/icons/global-a
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="toolbar toolbar-buttons<?php echo $is_add_global_attribute_visible ? ' hidden' : ''; ?>">
|
||||
<div class="toolbar toolbar-buttons">
|
||||
<span class="expand-close">
|
||||
<a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
|
||||
</span>
|
||||
|
||||
@@ -93,7 +93,7 @@ defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( $downloadable_files ) {
|
||||
foreach ( $downloadable_files as $key => $file ) {
|
||||
$disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
|
||||
$disabled_download = isset( $file['enabled'] ) && false === $file['enabled'];
|
||||
$disabled_downloads_count += (int) $disabled_download;
|
||||
include __DIR__ . '/html-product-download.php';
|
||||
}
|
||||
@@ -105,8 +105,8 @@ defined( 'ABSPATH' ) || exit;
|
||||
<th colspan="2">
|
||||
<a href="#" class="button insert" data-row="
|
||||
<?php
|
||||
$key = '';
|
||||
$file = array(
|
||||
$key = '';
|
||||
$file = array(
|
||||
'file' => '',
|
||||
'name' => '',
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
?>
|
||||
<label for="<?php echo esc_attr( $option['id'] ); ?>" class="<?php echo esc_attr( $option['wrapper_class'] ); ?> tips" data-tip="<?php echo esc_attr( $option['description'] ); ?>">
|
||||
<?php echo esc_html( $option['label'] ); ?>:
|
||||
<input type="checkbox" name="<?php echo esc_attr( $option['id'] ); ?>" id="<?php echo esc_attr( $option['id'] ); ?>" <?php echo checked( $selected_value, true, false ); ?> />
|
||||
<input type="checkbox" name="<?php echo esc_attr( $option['id'] ); ?>" id="<?php echo esc_attr( $option['id'] ); ?>" data-product-type-option-id="<?php echo esc_attr( $option['id'] ); ?>" <?php echo checked( $selected_value, true, false ); ?> />
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</span>
|
||||
|
||||
@@ -16,7 +16,7 @@ $arrow_img_url = WC_ADMIN_IMAGES_FOLDER_URL . '/product_data/no-variati
|
||||
<div id="variable_product_options" class="panel wc-metaboxes-wrapper hidden">
|
||||
<div id="variable_product_options_inner">
|
||||
|
||||
<?php if ( ! count( $variation_attributes ) && ( ( $global_attributes_count > 0 ) || ( $non_variation_attributes_count > 0 ) ) ) : ?>
|
||||
<?php if ( ! count( $variation_attributes ) ) : ?>
|
||||
|
||||
<div class="add-attributes-container">
|
||||
<div class="add-attributes-message">
|
||||
@@ -36,27 +36,6 @@ $arrow_img_url = WC_ADMIN_IMAGES_FOLDER_URL . '/product_data/no-variati
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php elseif ( ! count( $variation_attributes ) ) : ?>
|
||||
|
||||
<div id="message" class="inline notice woocommerce-message">
|
||||
<p>
|
||||
<?php echo esc_html_e( 'Offer customers multiple product options, like size and color. Start by creating a new custom attribute and enter available values (they’ll be shown as selectable product options).', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/variable-product/#add-variations"><?php esc_html_e( 'Learn more about creating variations', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="wc-metabox">
|
||||
<div class="woocommerce_variation_new_attribute_data wc-metabox-content">
|
||||
<?php
|
||||
$i = 0;
|
||||
$is_variations_screen = true;
|
||||
$attribute = new WC_Product_Attribute();
|
||||
$attribute->set_variation( true );
|
||||
require __DIR__ . '/html-product-attribute-inner.php';
|
||||
?>
|
||||
<div class="toolbar">
|
||||
<button type="button" aria-disabled="true" class="button button-primary create-variations disabled"><?php esc_html_e( 'Create variations', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
|
||||
<div class="toolbar toolbar-variations-defaults">
|
||||
|
||||
@@ -512,7 +512,7 @@ class WC_Admin_Report {
|
||||
}
|
||||
|
||||
if ( $data_key ) {
|
||||
$prepared_data[ $time ][1] += $d->$data_key;
|
||||
$prepared_data[ $time ][1] += is_numeric( $d->$data_key ) ? $d->$data_key : 0;
|
||||
} else {
|
||||
$prepared_data[ $time ][1] ++;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||
);
|
||||
|
||||
foreach ( $this->report_data->partial_refunds as $key => $order ) {
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = $order->total_refund - ( $order->total_shipping + $order->total_tax + $order->total_shipping_tax );
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = (float) $order->total_refund - ( (float) $order->total_shipping + (float) $order->total_tax + (float) $order->total_shipping_tax );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -158,22 +158,28 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
|
||||
|
||||
// Merge.
|
||||
$tax_rows = array();
|
||||
// Initialize an associative array to store unique post_ids.
|
||||
$unique_post_ids = array();
|
||||
|
||||
foreach ( $tax_rows_orders + $tax_rows_partial_refunds as $tax_row ) {
|
||||
$key = $tax_row->rate_id;
|
||||
$key = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
|
||||
'tax_amount' => 0,
|
||||
'shipping_tax_amount' => 0,
|
||||
'total_orders' => 0,
|
||||
);
|
||||
$tax_rows[ $key ]->total_orders += 1;
|
||||
$tax_rows[ $key ]->tax_rate = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ]->tax_amount += wc_round_tax_total( $tax_row->tax_amount );
|
||||
$tax_rows[ $key ]->shipping_tax_amount += wc_round_tax_total( $tax_row->shipping_tax_amount );
|
||||
if ( ! isset( $unique_post_ids[ $key ] ) || ! in_array( $tax_row->post_id, $unique_post_ids[ $key ], true ) ) {
|
||||
$unique_post_ids[ $key ] = isset( $unique_post_ids[ $key ] ) ? $unique_post_ids[ $key ] : array();
|
||||
$unique_post_ids[ $key ][] = $tax_row->post_id;
|
||||
$tax_rows[ $key ]->total_orders += 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $tax_rows_full_refunds as $tax_row ) {
|
||||
$key = $tax_row->rate_id;
|
||||
$key = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
|
||||
'tax_amount' => 0,
|
||||
'shipping_tax_amount' => 0,
|
||||
|
||||
@@ -193,7 +193,8 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Manage the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $gateway->id ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>';
|
||||
} else {
|
||||
if (
|
||||
'WooCommerce Payments' === $method_title &&
|
||||
// Keep old brand name for backwards compatibility.
|
||||
( 'WooCommerce Payments' === $method_title || 'WooPayments' === $method_title ) &&
|
||||
class_exists( 'WC_Payments_Account' )
|
||||
) {
|
||||
$setup_url = WC_Payments_Account::get_connect_url();
|
||||
|
||||
@@ -45,7 +45,7 @@ class WC_Settings_Products extends WC_Settings_Page {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings for the detault section.
|
||||
* Get settings for the default section.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -287,13 +287,15 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||
'zone_id' => $zone->get_id(),
|
||||
'wc_shipping_zones_nonce' => wp_create_nonce( 'wc_shipping_zones_nonce' ),
|
||||
'strings' => array(
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_changes_prompt' => __( 'Do you wish to save your changes first? Your changed data will be discarded if you choose to cancel.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'add_method_failed' => __( 'Shipping method could not be added. Please retry.', 'woocommerce' ),
|
||||
'yes' => __( 'Yes', 'woocommerce' ),
|
||||
'no' => __( 'No', 'woocommerce' ),
|
||||
'default_zone_name' => __( 'Zone', 'woocommerce' ),
|
||||
'unload_confirmation_msg' => __( 'Your changed data will be lost if you leave this page without saving.', 'woocommerce' ),
|
||||
'save_changes_prompt' => __( 'Do you wish to save your changes first? Your changed data will be discarded if you choose to cancel.', 'woocommerce' ),
|
||||
'save_failed' => __( 'Your changes were not saved. Please retry.', 'woocommerce' ),
|
||||
'add_method_failed' => __( 'Shipping method could not be added. Please retry.', 'woocommerce' ),
|
||||
'remove_method_failed' => __( 'Shipping method could not be removed. Please retry.', 'woocommerce' ),
|
||||
'yes' => __( 'Yes', 'woocommerce' ),
|
||||
'no' => __( 'No', 'woocommerce' ),
|
||||
'default_zone_name' => __( 'Zone', 'woocommerce' ),
|
||||
'delete_shipping_method_confirmation' => __( 'Are you sure you want to delete this shipping method?', 'woocommerce' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -57,6 +57,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="rates-bottom-pagination"></div>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-tax-table-row">
|
||||
<tr class="tips" data-tip="<?php printf( esc_attr__( 'Tax rate ID: %s', 'woocommerce' ), '{{ data.tax_rate_id }}' ); ?>" data-id="{{ data.tax_rate_id }}">
|
||||
<td class="country">
|
||||
|
||||
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
const currentStep = widget.data( 'current-step' );
|
||||
const totalSteps = widget.data( 'total-steps' );
|
||||
|
||||
$( document ).on( 'ready', function() {
|
||||
$( function() {
|
||||
window.wcTracks.recordEvent( 'wcadmin_setup_widget_view', {
|
||||
completed_tasks: currentStep,
|
||||
total_tasks: totalSteps,
|
||||
|
||||
@@ -136,10 +136,9 @@ $current_section_name = __( 'Browse Categories', 'woocommerce' );
|
||||
|
||||
<?php if ( 'Storefront' !== $theme['Name'] && '_featured' !== $current_section ) : ?>
|
||||
<?php
|
||||
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woocommerce.com/storefront/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=wcaddon' );
|
||||
$storefront_url = WC_Admin_Addons::add_in_app_purchase_url_params( 'https://woocommerce.com/products/storefront/?utm_source=extensionsscreen&utm_medium=product&utm_campaign=wcaddon' );
|
||||
?>
|
||||
<div class="storefront">
|
||||
<a href="<?php echo esc_url( $storefront_url ); ?>" target="_blank"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/storefront.png" alt="<?php esc_attr_e( 'Storefront', 'woocommerce' ); ?>" /></a>
|
||||
<h2><?php esc_html_e( 'Looking for a WooCommerce theme?', 'woocommerce' ); ?></h2>
|
||||
<p><?php echo wp_kses_post( __( 'We recommend Storefront, the <em>official</em> WooCommerce theme.', 'woocommerce' ) ); ?></p>
|
||||
<p><?php echo wp_kses_post( __( 'Storefront is an intuitive, flexible and <strong>free</strong> WordPress theme offering deep integration with WooCommerce and many of the most popular customer-facing extensions.', 'woocommerce' ) ); ?></p>
|
||||
|
||||
@@ -729,7 +729,7 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
|
||||
<td><?php echo esc_html( $settings['number_of_decimals'] ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Taxonomies: Product Types"><?php esc_html_e( 'Taxonomies: Product types', 'woocommerce' ); ?></th>
|
||||
<td data-export-label="Taxonomies: Product Types"><?php esc_html_e( 'Taxonomies: Product types', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'A list of taxonomy terms that can be used in regard to order/product statuses.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
@@ -742,7 +742,7 @@ if ( 0 < count( $dropins_mu_plugins['mu_plugins'] ) ) :
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="Taxonomies: Product Visibility"><?php esc_html_e( 'Taxonomies: Product visibility', 'woocommerce' ); ?></th>
|
||||
<td data-export-label="Taxonomies: Product Visibility"><?php esc_html_e( 'Taxonomies: Product visibility', 'woocommerce' ); ?></td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'A list of taxonomy terms used for product visibility.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
@@ -23,7 +23,7 @@ defined( 'ABSPATH' ) || exit;
|
||||
if ( $verify_db_tool_available ) {
|
||||
echo wp_kses_post(
|
||||
sprintf(
|
||||
/* translators: %1%s: Missing tables (seperated by ",") %2$s: Link to check again */
|
||||
/* translators: %1%s: Missing tables (separated by ",") %2$s: Link to check again */
|
||||
__( 'One or more tables required for WooCommerce to function are missing, some features may not work as expected. Missing tables: %1$s. <a href="%2$s">Check again.</a>', 'woocommerce' ),
|
||||
esc_html( implode( ', ', $missing_tables ) ),
|
||||
wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=verify_db_tables' ), 'debug_action' )
|
||||
@@ -32,7 +32,7 @@ defined( 'ABSPATH' ) || exit;
|
||||
} else {
|
||||
echo wp_kses_post(
|
||||
sprintf(
|
||||
/* translators: %1%s: Missing tables (seperated by ",") */
|
||||
/* translators: %1%s: Missing tables (separated by ",") */
|
||||
__( 'One or more tables required for WooCommerce to function are missing, some features may not work as expected. Missing tables: %1$s.', 'woocommerce' ),
|
||||
esc_html( implode( ', ', $missing_tables ) )
|
||||
)
|
||||
|
||||
@@ -508,18 +508,20 @@ function wc_render_invalid_variation_notice( $product_object ) {
|
||||
|
||||
// Check if a variation exists without pricing data.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
|
||||
$invalid_variation_count = $wpdb->get_var(
|
||||
$valid_variation_count = $wpdb->get_var(
|
||||
"
|
||||
SELECT count(post_id) FROM {$wpdb->postmeta}
|
||||
WHERE post_id in (" . implode( ',', array_map( 'absint', $variation_ids ) ) . ")
|
||||
AND ( meta_key='_subscription_sign_up_fee' OR meta_key='_price' )
|
||||
AND meta_value > 0
|
||||
AND meta_value >= 0
|
||||
AND meta_value != ''
|
||||
"
|
||||
);
|
||||
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
|
||||
|
||||
if ( 0 < ( $variation_count - $invalid_variation_count ) ) {
|
||||
$invalid_variation_count = $variation_count - $valid_variation_count;
|
||||
|
||||
if ( 0 < $invalid_variation_count ) {
|
||||
?>
|
||||
<div id="message" class="inline notice notice-warning woocommerce-message woocommerce-notice-invalid-variation">
|
||||
<p>
|
||||
@@ -527,8 +529,8 @@ function wc_render_invalid_variation_notice( $product_object ) {
|
||||
echo wp_kses_post(
|
||||
sprintf(
|
||||
/* Translators: %d variation count. */
|
||||
_n( '%d variation does not have a price.', '%d variations do not have prices.', ( $variation_count - $invalid_variation_count ), 'woocommerce' ),
|
||||
( $variation_count - $invalid_variation_count )
|
||||
_n( '%d variation does not have a price.', '%d variations do not have prices.', $invalid_variation_count, 'woocommerce' ),
|
||||
$invalid_variation_count
|
||||
) . ' ' .
|
||||
__( 'Variations (and their attributes) that do not have prices will not be shown in your store.', 'woocommerce' )
|
||||
);
|
||||
@@ -561,3 +563,29 @@ function wc_get_current_admin_url() {
|
||||
|
||||
return remove_query_arg( array( '_wpnonce', '_wc_notice_nonce', 'wc_db_update', 'wc_db_update_nonce', 'wc-hide-notice' ), admin_url( $uri ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default product type options.
|
||||
*
|
||||
* @internal
|
||||
* @since 7.9.0
|
||||
* @return array
|
||||
*/
|
||||
function wc_get_default_product_type_options() {
|
||||
return array(
|
||||
'virtual' => array(
|
||||
'id' => '_virtual',
|
||||
'wrapper_class' => 'show_if_simple',
|
||||
'label' => __( 'Virtual', 'woocommerce' ),
|
||||
'description' => __( 'Virtual products are intangible and are not shipped.', 'woocommerce' ),
|
||||
'default' => 'no',
|
||||
),
|
||||
'downloadable' => array(
|
||||
'id' => '_downloadable',
|
||||
'wrapper_class' => 'show_if_simple',
|
||||
'label' => __( 'Downloadable', 'woocommerce' ),
|
||||
'description' => __( 'Downloadable products give access to a file upon purchase.', 'woocommerce' ),
|
||||
'default' => 'no',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user