plugin updates

This commit is contained in:
Tony Volpe
2024-09-05 11:04:01 -04:00
parent ed6b060261
commit 50cd64dd3d
925 changed files with 16918 additions and 13003 deletions

View File

@@ -11,6 +11,8 @@ if ( class_exists( 'WC_Settings_Accounts', false ) ) {
return new WC_Settings_Accounts();
}
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
/**
* WC_Settings_Accounts.
*/
@@ -50,8 +52,9 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'id' => 'account_registration_options',
),
array(
'title' => __( 'Guest checkout', 'woocommerce' ),
'desc' => __( 'Allow customers to place orders without an account', 'woocommerce' ),
'title' => __( 'Checkout', 'woocommerce' ),
'desc' => __( 'Enable guest checkout (recommended)', 'woocommerce' ),
'desc_tip' => __( 'Allows customers to checkout without an account.', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',
'default' => 'yes',
'type' => 'checkbox',
@@ -60,7 +63,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
),
array(
'title' => __( 'Login', 'woocommerce' ),
'desc' => __( 'Allow customers to log into an existing account during checkout', 'woocommerce' ),
'desc' => __( 'Enable log-in during checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_checkout_login_reminder',
'default' => 'no',
'type' => 'checkbox',
@@ -69,31 +72,38 @@ class WC_Settings_Accounts extends WC_Settings_Page {
),
array(
'title' => __( 'Account creation', 'woocommerce' ),
'desc' => __( 'Allow customers to create an account during checkout', 'woocommerce' ),
'desc' => __( 'During checkout', 'woocommerce' ),
'desc_tip' => __( 'Customers can create an account before placing their order.', 'woocommerce' ),
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'legend' => __( 'Allow customers to create an account:', 'woocommerce' ),
'autoload' => false,
),
array(
'title' => __( 'Account creation', 'woocommerce' ),
'desc' => __( 'On "My account" page', 'woocommerce' ),
'id' => 'woocommerce_enable_myaccount_registration',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false,
),
array(
'title' => __( 'Account creation options', 'woocommerce' ),
'desc' => __( 'Use email address as account login (recommended)', 'woocommerce' ),
'desc_tip' => __( 'If unchecked, customers will need to set a username during account creation.', 'woocommerce' ),
'id' => 'woocommerce_registration_generate_username',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false,
),
array(
'desc' => __( 'Allow customers to create an account on the "My account" page', 'woocommerce' ),
'id' => 'woocommerce_enable_myaccount_registration',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => '',
'autoload' => false,
),
array(
'desc' => __( 'When creating an account, automatically generate an account username for the customer based on their name, surname or email', 'woocommerce' ),
'id' => 'woocommerce_registration_generate_username',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
'autoload' => false,
),
array(
'desc' => __( 'When creating an account, send the new user a link to set their password', 'woocommerce' ),
'title' => __( 'Account creation options', 'woocommerce' ),
'desc' => __( 'Send password setup link (recommended)', 'woocommerce' ),
'desc_tip' => __( 'New customers receive an email to set up their password.', 'woocommerce' ),
'id' => 'woocommerce_registration_generate_password',
'default' => 'yes',
'type' => 'checkbox',
@@ -118,7 +128,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'id' => 'woocommerce_erasure_request_removes_download_data',
'type' => 'checkbox',
'default' => 'no',
'checkboxgroup' => 'end',
'checkboxgroup' => '',
'autoload' => false,
),
array(
@@ -127,7 +137,7 @@ class WC_Settings_Accounts extends WC_Settings_Page {
'desc_tip' => __( 'Adds an option to the orders screen for removing personal data in bulk. Note that removing personal data cannot be undone.', 'woocommerce' ),
'id' => 'woocommerce_allow_bulk_remove_personal_data',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'checkboxgroup' => 'end',
'default' => 'no',
'autoload' => false,
),
@@ -229,10 +239,71 @@ class WC_Settings_Accounts extends WC_Settings_Page {
),
);
return apply_filters(
'woocommerce_' . $this->id . '_settings',
$account_settings
);
// Change settings when using the block based checkout.
if ( CartCheckoutUtils::is_checkout_block_default() ) {
$account_settings = array_filter(
$account_settings,
function ( $setting ) {
return 'woocommerce_registration_generate_username' !== $setting['id'];
},
);
$account_settings = array_map(
function ( $setting ) {
if ( 'woocommerce_registration_generate_password' === $setting['id'] ) {
unset( $setting['checkboxgroup'] );
}
return $setting;
},
$account_settings
);
}
/**
* Filter account settings.
*
* @hook woocommerce_account_settings
* @since 3.5.0
* @param array $account_settings Account settings.
*/
return apply_filters( 'woocommerce_' . $this->id . '_settings', $account_settings );
}
/**
* Output the HTML for the settings.
*/
public function output() {
parent::output();
// The following code toggles disabled state on the account options based on other values.
?>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
const checkboxes = [
document.getElementById("woocommerce_enable_signup_and_login_from_checkout"),
document.getElementById("woocommerce_enable_myaccount_registration"),
document.getElementById("woocommerce_enable_signup_from_checkout_for_subscriptions")
];
const inputs = [
document.getElementById("woocommerce_registration_generate_username"),
document.getElementById("woocommerce_registration_generate_password")
];
function updateInputs() {
const isChecked = checkboxes.some(cb => cb && cb.checked);
inputs.forEach(input => {
if ( ! input ) {
return;
}
input.disabled = !isChecked;
input.closest('td').classList.toggle("disabled", !isChecked);
});
}
checkboxes.forEach(cb => cb && cb.addEventListener('change', updateInputs));
updateInputs(); // Initial state
});
</script>
<?php
}
}

View File

@@ -391,7 +391,7 @@ class WC_Settings_Advanced extends WC_Settings_Page {
__( 'The legacy REST API is NOT enabled', 'woocommerce' );
$legacy_api_setting_tip =
is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ) ?
WC()->legacy_rest_api_is_available() ?
__( ' The WooCommerce Legacy REST API extension is installed and active.', 'woocommerce' ) :
sprintf(
/* translators: placeholders are URLs */

View File

@@ -189,17 +189,20 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
break;
case 'action':
$setup_url = admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . strtolower( $gateway->id ) );
// Override the behaviour for WooPayments plugin.
// Override the behaviour for the WooPayments plugin.
if (
// Keep old brand name for backwards compatibility.
( 'WooCommerce Payments' === $method_title || 'WooPayments' === $method_title ) &&
class_exists( 'WC_Payments_Account' )
) {
if ( ! WooCommercePayments::is_connected() || WooCommercePayments::is_account_partially_onboarded() ) {
// The CTA text and label is "Finish set up" if the account is not connected or not completely onboarded.
$setup_url = WC_Payments_Account::get_connect_url(); // Plugin will handle the redirection to the connect page or directly to the provider (e.g. Stripe).
// The CTA text and label is "Finish setup" if the account is not connected or not completely onboarded.
// Plugin will handle the redirection to the connect page or directly to the provider (e.g. Stripe).
$setup_url = WC_Payments_Account::get_connect_url();
// Add the `from` parameter to the URL, so we know where the user came from.
$setup_url = add_query_arg( 'from', 'WCADMIN_PAYMENT_SETTINGS', $setup_url );
/* Translators: %s Payment gateway name. */
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Set up the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( $setup_url ) . '">' . esc_html__( 'Finish set up', 'woocommerce' ) . '</a>';
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Set up the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( $setup_url ) . '">' . esc_html__( 'Finish setup', 'woocommerce' ) . '</a>';
} else {
// If the account is fully onboarded, the CTA text and label is "Manage" regardless gateway is enabled or not.
/* Translators: %s Payment gateway name. */
@@ -210,7 +213,7 @@ 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( $setup_url ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>';
} else {
/* Translators: %s Payment gateway name. */
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Set up the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( $setup_url ) . '">' . esc_html__( 'Finish set up', 'woocommerce' ) . '</a>';
echo '<a class="button alignright" aria-label="' . esc_attr( sprintf( __( 'Set up the "%s" payment method', 'woocommerce' ), $method_title ) ) . '" href="' . esc_url( $setup_url ) . '">' . esc_html__( 'Finish setup', 'woocommerce' ) . '</a>';
}
break;
case 'status':

View File

@@ -446,6 +446,20 @@ class WC_Settings_Products extends WC_Settings_Page {
),
),
array(
'title' => __( 'Count partial downloads', 'woocommerce' ),
'desc' => __( 'Count downloads even if only part of a file is fetched.', 'woocommerce' ),
'id' => 'woocommerce_downloads_count_partial',
'type' => 'checkbox',
'default' => 'yes',
'desc_tip' => sprintf(
/* Translators: 1: opening link tag 2: closing link tag. */
__( 'Repeat fetches made within a reasonable window of time (by default, 30 minutes) will not be counted twice. This is a generally reasonably way to enforce download limits in relation to ranged requests. %1$sLearn more.%2$s', 'woocommerce' ),
'<a href="https://woocommerce.com/document/digital-downloadable-product-handling/">',
'</a>'
),
),
array(
'type' => 'sectionend',
'id' => 'digital_download_options',

View File

@@ -7,6 +7,7 @@
use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils;
use Automattic\WooCommerce\Blocks\Shipping\ShippingController;
use Automattic\WooCommerce\StoreApi\Utilities\LocalPickupUtils;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -242,10 +243,15 @@ do_action( 'woocommerce_shipping_zone_after_methods_table', $zone );
);
} else {
/* translators: %s: Local pickup settings page URL. */
$message = __( 'Local pickup: Set up pickup locations in the <a href="%s">Local pickup settings page</a>.', 'woocommerce' );
if ( LocalPickupUtils::is_local_pickup_enabled() ) {
/* translators: %s: Local pickup settings page URL. */
$message = __( 'Local pickup: Manage existing pickup locations in the <a href="%s">Local pickup settings page</a>.', 'woocommerce' );
}
printf(
wp_kses(
/* translators: %s: Local pickup settings page URL. */
__( 'Local pickup: Set up pickup locations in the <a href="%s">Local pickup settings page</a>.', 'woocommerce' ),
$message,
array( 'a' => array( 'href' => array() ) )
),
esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&section=pickup_location' ) )

View File

@@ -147,9 +147,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php endforeach; ?>
<?php
$legacy_api_option_name =
is_null( wc()->api ) ?
__( 'Legacy API v3 (⚠️ NOT AVAILABLE)', 'woocommerce' ) :
__( 'Legacy API v3 (deprecated)', 'woocommerce' );
WC()->legacy_rest_api_is_available() ?
__( 'Legacy API v3 (deprecated)', 'woocommerce' ) :
__( 'Legacy API v3 (⚠️ NOT AVAILABLE)', 'woocommerce' );
?>
<option value="legacy_v3" <?php selected( 'legacy_v3', $webhook->get_api_version(), true ); ?>><?php echo esc_html( $legacy_api_option_name ); ?></option>
</select>