You can use the snippets from this page to customize the appearance and functionality of WooCommerce Subscriptions.
To use a snippet, you can copy the code to your site or download the linked file. We would recommend adding these snippets into a separate snippet plugin rather than modifying your site’s theme files or functions.php file.
Scope of support:
We are unable to provide support for customizations under our Support Policy. If you need to customize a snippet or extend its functionality, we recommend working with a Woo Agency Partner or a WooCommerce developer on Codeable.
Customizing Subscriptions My Account Functionality
↑ Back to topAdd Pay Action
↑ Back to topThis code ensures that the Pay button appears directly next to a subscription that is pending payment on the My Account > View Subscription page. By doing this, it saves users from having to scroll down to find the corresponding order and makes it easier for them to complete payment.
One-Time Confirmation Of Subscription Cancellation
↑ Back to topThis snippet adds a confirmation dialog when a customer attempts to cancel their subscription, asking if they’re sure before proceeding. It helps prevent accidental cancellations and can be toggled on or off in WooCommerce > Settings > Subscriptions.
Delete Payment Method Confirmation
↑ Back to topThis snippet shows a confirmation dialog when a customer removes a saved payment method, reminding them that any subscriptions using that method will also need to be updated. It can help reduce failed payments by prompting users to take action before deleting the payment method.
Hide The “Payment Methods” Tab From The “My Account” Page
↑ Back to topThis snippet removes the Payment Methods tab from the My Account area in WooCommerce. It’s useful when you want to prevent customers from managing saved payment methods directly through their account dashboard.
hide-payment-methods-tab.php content:
<?php
add_filter( 'woocommerce_account_menu_items', 'remove_payment_methods_tab_my_account', 999 );
function remove_payment_methods_tab_my_account( $items ) {
unset($items['payment-methods']);
return $items;
}
Hide The ‘Cancel’ Button From The My Account Page With Subscriptions
↑ Back to topThis snippet removes the Cancel button from the actions listed on a subscription in the My Account > View Subscription page. It prevents customers from cancelling their own subscriptions while still allowing other actions to be displayed.
hide_cancel_button.php content:
<?php
function eg_remove_my_subscriptions_button( $actions, $subscription ) {
foreach ( $actions as $action_key => $action ) {
switch ( $action_key ) {
case 'cancel': // Hide "Cancel" button on subscriptions that are "active" or "on-hold"?
unset( $actions[ $action_key ] );
break;
default:
error_log( '-- $action = ' . print_r( $action, true ) );
break;
}
}
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'eg_remove_my_subscriptions_button', 100, 2 );
Add A ‘Change Payment’ Button To The My Account Page With Subscriptions
↑ Back to topThis snippet displays a Change Payment button directly on the My Account > Subscriptions page if it’s available for the subscription. It makes it easier for customers to update their payment method without navigating into the subscription details.
wcs_add_change_payment_button_to_subscriptions_page.php content:
<?php
function wcs_add_change_payment_button_to_subscriptions_page($subscription) {
$actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() );
if(!empty($actions)){
foreach ( $actions as $key => $action ){
if(strtolower($action['name']) == "change payment"){
$changePaymentLink = esc_url( $action['url'] );
echo "<a href='$changePaymentLink' class='button change_payment_method'>".$action['name']."</a>";
}
}
}
}
add_action( 'woocommerce_my_subscriptions_actions', 'wcs_add_change_payment_button_to_subscriptions_page', 10 );
Add A ‘Renew Now’ Button To The My Account Page With Subscriptions
↑ Back to topThis adds a Renew Now button directly to the My Account > Subscriptions page when early renewal is available. It allows customers to manually renew their subscription without needing to view the subscription details first.
wcs_add_renew_now_button_to_subscriptions_page.php content:
<?php
function wcs_add_renew_now_button_to_subscriptions_page($subscription) {
$actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() );
if(!empty($actions)){
foreach ( $actions as $key => $action ){
if(strtolower($action['name']) == "renew now"){
$renewNowLink = esc_url( $action['url'] );
echo "<a href='$renewNowLink' class='button subscription_renewal_early'>".$action['name']."</a>";
}
}
}
}
add_action( 'woocommerce_my_subscriptions_actions', 'wcs_add_renew_now_button_to_subscriptions_page', 10 );
Add A ‘Cancel’ Button To The My Account Page
↑ Back to topThis snippet adds a Cancel button directly to the My Account > Subscriptions page when cancellation is allowed. It gives customers a quicker way to cancel their subscription without needing to open the full subscription details.
wcs_add_cancel_button_on_subscriptions_page.php content:
<?php
function wcs_add_cancel_button_on_subscriptions_page($subscription) {
$actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() );
if(!empty($actions)){
foreach ( $actions as $key => $action ){
if(strtolower($action['name']) == "cancel"){
$cancelLink = esc_url( $action['url'] );
echo "<a href='$cancelLink' class='button cancel'>".$action['name']."</a>";
}
}
}
}
add_action( 'woocommerce_my_subscriptions_actions', 'wcs_add_cancel_button_on_subscriptions_page', 10 );
Hide Specific Action Buttons Based On Subscription Product
↑ Back to topThis snippet conditionally hides selected action buttons (like Change Payment Method) from the My Account > View Subscription page, but only for subscriptions that include a specific product (identified by its product ID). For all other subscriptions, the full set of actions remains available.
Hide action buttons for specific product ID's content:
<?php
function eg_remove_my_subscriptions_button( $actions, $subscription ) {
$product_id = 228; // Update with correct product ID
if ( $subscription->has_product( $product_id ) ) {
foreach ( $actions as $action_key => $action ) {
switch ( $action_key ) {
case 'change_payment_method': // Hide
// case 'change_address': // Hide
// case 'switch': // Hide
// case 'resubscribe': // Hide
// case 'pay': // Hide
// case 'reactivate': // Hide
// case 'cancel': // Hide
unset( $actions[ $action_key ] );
break;
default:
error_log( '-- $action = ' . print_r( $action, true ) );
break;
}
}
return $actions;
} else {
foreach ( $actions as $action_key => $action ) {
switch ( $action_key ) {
case 'change_payment_method': // Show
case 'change_address': // Show
case 'switch': // Show
case 'resubscribe': // Show
case 'pay': // Show
case 'reactivate': // Show
case 'cancel': // Show
// unset( $actions[ $action_key ] );
break;
default:
error_log( '-- $action = ' . print_r( $action, true ) );
break;
}
}
return $actions;
}
}
add_filter( 'wcs_view_subscription_actions', 'eg_remove_my_subscriptions_button', 100, 2 );
Prevent Subscription Suspension Based On Product
↑ Back to topThis snippet disables the option for customers to suspend (put on hold) subscriptions that include specific products, based on their product IDs. If a subscription contains any of the listed products, the Suspend action will no longer be available in the My Account area.
prevent_suspension_per_product.php content:
function prevent_suspension_per_product( $user_can_suspend, $subscription ) {
if ( ! $user_can_suspend ) {
return $user_can_suspend;
}
$product_ids = array(438,128,2,345); // Change to whatever product ids you want to prevent suspension for
foreach ( $product_ids as $product_id ) {
if ( $subscription->has_product( $product_id ) ) {
$user_can_suspend = false;
break;
}
}
return $user_can_suspend;
}
add_filter( 'wcs_can_user_put_subscription_on_hold', 'prevent_suspension_per_product', 15, 2 );
Hide The ‘Cancel’ Button During The Trial Period
↑ Back to topThis snippet hides the Cancel button on the My Account > View Subscription page while a subscription is still in its trial period. Once the trial ends, the Cancel button becomes visible again, allowing users to manage their subscription normally.
wcs_remove_cancel_button_in_trial.php content:
<?php
function wcs_remove_cancel_button_in_trial ( $actions, $subscription ) {
$current_timestamp = current_time( 'timestamp', true );
$trial_end_timestamp = $subscription->get_time( 'trial_end' );
if ( $current_timestamp > $trial_end_timestamp ) {
return $actions;
} else {
// Hide "Cancel" button.
unset( $actions['cancel'] );
return $actions;
}
}
add_filter( 'wcs_view_subscription_actions', 'wcs_remove_cancel_button_in_trial', 100, 2 );
Hide The ‘Cancel’ Button When A Subscription Has An End Date
↑ Back to topThis snippet removes the Cancel button from the My Account > View Subscription page if the subscription has a set end date and is still active. It helps prevent users from cancelling subscriptions that are already scheduled to end automatically.
wcs_remove_cancel_button_end_date.php content:
<?php
/**
* Remove the "cancel" button.
*
* @param array $actions Array of action buttons.
* @param WC_Subscription $subscription The subscription object.
*
* @return array The filtered array of actions.
*/
function wcs_remove_cancel_button_end_date ( $actions, $subscription ) {
if ( $subscription->get_time( 'end' ) === 0 || $next_payment_timestamp > $subscription->get_time( 'end' ) ) {
return $actions;
}
// Hide "Cancel" button.
unset( $actions['cancel'] );
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'wcs_remove_cancel_button_end_date', 100, 2 );
WooCommerce Subscriptions Frontend Customization
↑ Back to topCustomize Price Strings Displayed For Subscription Products
↑ Back to topThis mini-extension for WooCommerce Subscriptions lets you modify the default price text shown on product pages, including for simple, variable, and subscription products. It gives you full control over how prices appear, including “From” prices and those for bookable products.
Automatically Apply A Coupon To Resubscribe Carts
↑ Back to topThis plugin auto-applies a specific coupon to every resubscribe cart by defining it with the WOOCOMMERCE_SUBSCRIPTIONS_AUTO_RESUBSCRIBE_COUPON
constant. While it’s applied during resubscription, the coupon itself isn’t limited to those carts and can be used elsewhere unless additional restrictions are set.
Hide Products From A Specific Category On The Shop Page
↑ Back to topThis snippet prevents products in a designated category (e.g., not-displayed
) from appearing on the main Shop page. It’s useful for keeping certain products visible only through direct links or specific collections, rather than in general browsing.
wcs_hide_unwanted_category.php content:
<?php
/**
* Exclude products from a particular category on the shop page
*/
function wcs_hide_unwanted_category( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'not-displayed' ), // Don't display products in the clothing category on the shop page.
'operator' => 'NOT IN'
);
$q->set( 'tax_query', $tax_query );
}
add_action( 'woocommerce_product_query', 'wcs_hide_unwanted_category' );
Redirect Subscription Product Add-To-Cart To The Cart Page
↑ Back to topThis snippet redirects customers to the Cart page immediately after adding a subscription product to their cart. It replaces the default behavior (usually staying on the product page or going to a custom URL) to streamline the checkout process for subscription purchases.
wcs_redirect_to_cart.php content:
<?php
function wcs_redirect_to_cart( $url ) {
// If product is of the subscription type
if ( is_numeric( $_REQUEST['add-to-cart'] ) && WC_Subscriptions_Product::is_subscription( (int) $_REQUEST['add-to-cart'] ) ) {
// Redirect to cart instead
$url = WC()->cart->get_cart_url();
}
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'wcs_redirect_to_cart', 20 );
Rename Billing Section When No Payment Is Needed At Checkout
↑ Back to topThis changes the Billing Details heading to Account Info on the checkout page, but only when no payment is required (e.g., free trial or free product). It helps tailor the checkout experience to better reflect what’s actually being collected from the customer.
wcs_change_billing_details_string.php content:
<?php
function wcs_free_checkout_fields() {
// Bail we're not at checkout, or if we're at checkout but payment is needed
if ( function_exists( 'is_checkout' ) && ( ! is_checkout() || ( is_checkout() && WC()->cart->needs_payment() ) ) ) {
return;
}
// Change string here
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Account Info', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
}
add_action( 'wp', 'wcs_free_checkout_fields' );
Redirect Add-To-Cart To A Custom Page
↑ Back to topThis snippet redirects customers to a specific page (by page ID) after they add a product to their cart. It overrides the default WooCommerce add-to-cart redirect and can be used to send users to a custom landing, upsell, or info page.
custom_a2c.php content:
<?php
function custom_a2c( $url ) {
$url = get_permalink( 121 ); // URL to redirect to (121 is the page ID here)
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_a2c' );
Subscription Management For Store Admins
↑ Back to topCancel Subscription After All Failed Payment Retry Attempts
↑ Back to topThis plugin automatically cancels both the order and its related subscription if all automatic payment retry attempts fail. It goes beyond WooCommerce Subscriptions’ default behavior—where subscriptions are simply placed on-hold – by ensuring they’re fully cancelled after the retry process is exhausted.
Skip Pending Cancellation Status When Customer Cancels
↑ Back to topThis plugin changes the default cancellation flow by immediately setting a subscription’s status to Cancelled when a customer cancels it from their My Account page. It bypasses the usual Pending Cancellation status used by WooCommerce Subscriptions.
Cancel Subscription When Latest Order Is Fully Refunded
↑ Back to topThis plugin automatically cancels a subscription if its parent or most recent renewal order is fully refunded. The subscription is immediately set to Cancelled without passing through the Pending Cancellation status. Refunds on older orders will not trigger cancellation.
Create Coupons That Only Apply To Manual Renewals
↑ Back to topThis plugin lets you create discount coupons that are valid only for manual subscription renewals – not for initial sign-ups. Store managers can configure eligible coupon codes via the settings screen, a constant, or a filter, and while they can apply them freely, customers can only use them when paying for a renewal order.
Limit Subscription Products To A Fixed Number Of Active Subscriptions
↑ Back to topThis plugin restricts subscription products to a set number of active (unended) subscriptions across the site. It’s useful for cases where products should only be subscribed to a limited number of times—such as one-to-one sponsorships or exclusive memberships. Once the limit is reached, the product becomes unpurchasable on the front end, while still allowing manual renewals and failed payment recoveries to proceed normally.
Preserve Original Billing Schedule After Late Payments
↑ Back to topThis plugin ensures that a subscription’s next renewal date is always based on the original scheduled payment date, not the actual date the payment was made. This keeps the billing cycle consistent – even if a customer pays late – so the subscription always renews on its intended schedule (e.g., the 1st of each month), rather than shifting forward.
Allow Early Renewal For Synchronized Subscriptions
↑ Back to topThis plugin enables early renewal for subscriptions that include synchronized products in WooCommerce Subscriptions. It gives customers the flexibility to renew ahead of schedule, even when their subscription has been aligned to a specific billing date.
Prevent Stock Reduction On Subscription Renewal Orders
↑ Back to topBy default, WooCommerce reduces product stock for both initial purchases and subscription renewals. This plugin disables stock reduction for renewal orders, ensuring inventory is only adjusted on the initial purchase.
Customize Failed Payment Retry Rules And Email Customer Immediately
↑ Back to topThis snippet replaces the default WooCommerce Subscriptions retry rules with a custom schedule that includes multiple retry attempts over several days. It sends an email to the customer immediately after the first failed payment, helping prompt quicker action. Each retry keeps the order in pending status and the subscription on-hold throughout the process.
wcs_my_custom_retry_rules.php content:
<?php
function wcs_my_custom_retry_rules( $default_retry_rules_array ) {
return array(
array(
'retry_after_interval' => DAY_IN_SECONDS / 2, // how long to wait before retrying
'email_template_customer' => 'WCS_Email_Customer_Payment_Retry', // email customer immediately upon first failed payment
'email_template_admin' => 'WCS_Email_Payment_Retry',
'status_to_apply_to_order' => 'pending',
'status_to_apply_to_subscription' => 'on-hold',
),
array(
'retry_after_interval' => DAY_IN_SECONDS / 2,
'email_template_customer' => 'WCS_Email_Customer_Payment_Retry',
'email_template_admin' => 'WCS_Email_Payment_Retry',
'status_to_apply_to_order' => 'pending',
'status_to_apply_to_subscription' => 'on-hold',
),
array(
'retry_after_interval' => DAY_IN_SECONDS,
'email_template_customer' => 'WCS_Email_Customer_Payment_Retry',
'email_template_admin' => 'WCS_Email_Payment_Retry',
'status_to_apply_to_order' => 'pending',
'status_to_apply_to_subscription' => 'on-hold',
),
array(
'retry_after_interval' => DAY_IN_SECONDS * 2,
'email_template_customer' => 'WCS_Email_Customer_Payment_Retry',
'email_template_admin' => 'WCS_Email_Payment_Retry',
'status_to_apply_to_order' => 'pending',
'status_to_apply_to_subscription' => 'on-hold',
),
array(
'retry_after_interval' => DAY_IN_SECONDS * 3,
'email_template_customer' => 'WCS_Email_Customer_Payment_Retry',
'email_template_admin' => 'WCS_Email_Payment_Retry',
'status_to_apply_to_order' => 'pending',
'status_to_apply_to_subscription' => 'on-hold',
),
);
}
add_filter( 'wcs_default_retry_rules', 'wcs_my_custom_retry_rules' );
Prevent User Role Changes On Subscription Status Updates
↑ Back to topThis snippet disables the automatic user role changes that WooCommerce Subscriptions would normally apply when a subscription is activated, cancelled, or expired. It ensures a customer’s WordPress user role remains unchanged regardless of their subscription status.
disable_user_role_change.php content:
<?php
add_filter( 'woocommerce_subscriptions_update_users_role', '__return_false', 100 );
Add A Custom Subscription Frequency Interval
↑ Back to topThis snippet adds a custom subscription frequency (e.g. every 50 months, weeks, etc.) to the list of available intervals in WooCommerce Subscriptions. Store owners can adjust the $custom_frequency
value to suit their needs and offer more flexible billing options.
wcs_custom_frequency.php content:
<?php
function wcs_custom_frequency( $intervals ) {
// change the $custom_frequency variable numerical value to what you'd like to add.
$custom_frequency = 50;
$intervals[$custom_frequency] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( $custom_frequency ) );
return $intervals;
}
add_filter( 'woocommerce_subscription_period_interval_strings', 'wcs_custom_frequency' );
Send Cancelled Order Emails To Customers
↑ Back to topThis snippet adds the customer’s email address to the recipient list for Cancelled Order email notifications in WooCommerce. It ensures that customers are informed directly when their order is cancelled, alongside the usual admin notification.
wc_cancelled_order_add_customer_email.php content:
<?php
/*
* Add customer email to Cancelled Order recipient list
*/
function wc_cancelled_order_add_customer_email( $recipient, $order ){
return $recipient . ',' . $order->billing_email;
}
add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10, 2 );
Add Custom Subscription Length Options
↑ Back to topThis snippet extends the list of available subscription lengths in WooCommerce Subscriptions by adding new options such as 48 months, 10 years, and 20 years. It allows store owners to offer longer-term subscription plans directly from the product settings.
eg_extend_subscription_expiration_options.php content:
<?php
function eg_extend_subscription_expiration_options( $subscription_lengths ) {
$subscription_lengths['year'][10] = wcs_get_subscription_period_strings( 10, 'year' );
$subscription_lengths['year'][20] = wcs_get_subscription_period_strings( 20, 'year' );
$subscription_lengths['month'][48] = wcs_get_subscription_period_strings( 48, 'month' );
return $subscription_lengths;
}
add_filter( 'woocommerce_subscription_lengths', 'eg_extend_subscription_expiration_options' );
Allow Customers To Continue Accessing Downloads After Cancelled Or Expired Subscription
↑ Back to topThis snippet allows customers to continue accessing their downloadable files even if their subscription is cancelled or expired. It overrides the default WooCommerce Subscriptions behavior, ensuring downloads remain available regardless of status.
expand_access_subscription_downloads.php content:
<?php
function expand_access_subscription_downloads( $is_download_permitted, $subscription ) {
if ( $subscription->has_status ( 'cancelled', 'expired' ) ) {
return true;
}
return $is_download_permitted;
}
add_filter ( 'woocommerce_order_is_download_permitted', 'expand_access_subscription_downloads', 10, 2 );
Pause All WooCommerce Subscription Renewals
↑ Back to topThis mini-plugin temporarily halts all WooCommerce Subscriptions renewals by preventing key scheduled actions from being claimed by Action Scheduler. It pauses automatic payments, retries, and end-of-term processing—without affecting other scheduled tasks. Once unpaused, any missed actions will run immediately.
Note: it only applies to subscriptions managed by WooCommerce Subscriptions, not legacy PayPal Standard or WooPayments subscriptions.
Other WooCommerce Subscriptions Tools
↑ Back to topWooCommerce Subscriptions Importer and Exporter
↑ Back to topThis free tool helps migrate subscriber data into WooCommerce Subscriptions by importing and exporting subscription records via CSV. While powerful, it requires careful manual formatting and testing. You can find out more about this tool and how to get support with migrating to WooCommerce Subscriptions here.
Disable Automatic Cache Updates For Subscription Reports
↑ Back to topThis plugin stops WooCommerce Subscriptions from automatically updating the cache for subscription reports. It can help improve performance or prevent unintended data refreshes in reporting-heavy environments.
Recalculate Subscription Totals After Tax Setting Changes
↑ Back to topThis plugin forces WooCommerce Subscriptions to recalculate totals for all subscriptions, ensuring that any updated tax settings are correctly applied. It’s useful when tax rules change after subscriptions have already been created.
Log Renewal Events To Diagnose Failed Automatic Payments
↑ Back to topThis plugin helps identify why automatic subscription renewals aren’t being processed, even when using an automatic payment gateway. It logs key details about renewal events to WooCommerce log files, using a filename prefix of wcs-renewal-log-
, making it easier to trace issues and troubleshoot failed payments.
Reset Next Payment Dates To Prevent Duplicate Renewals
↑ Back to topThis helper plugin adjusts all subscription next payment dates, and pushing them back by 1 minute. It’s designed to help resolve issues with duplicate renewal payments, which can occur due to timezone discrepancies in WooCommerce Subscriptions.
Disable Staging Mode In WooCommerce Subscriptions
↑ Back to topThis plugin disables Staging Mode in WooCommerce Subscriptions, which is normally triggered when a site’s URL changes. It’s useful for setups with multiple front-end URLs—such as multilingual sites using WPML—where all environments share a single WordPress instance.
Note: it allows live payments to process even on duplicate or staging URLs, so manual care is required when cloning the site.
Enable Automatic Payments For Specific Subscriptions In Staging Mode
↑ Back to topThis plugin allows automatic payments to be processed for selected subscriptions even when WooCommerce Subscriptions is in Staging Mode. It’s ideal for safely testing payment functionality on staging environments without fully disabling the protections that prevent duplicate charges.
Log Start And End Of Renewal Events To Measure Duration
↑ Back to topThis plugin logs the start and end times of subscription renewal events to help you monitor how long the renewal process takes. Logs are saved to WooCommerce log files with the prefix wcs-renewal-log-
, which you can view by navigating to WooCommerce > System Status > Logs.
Display Subscription Status Notice In Admin Dashboard
↑ Back to topThis snippet checks the status of a specific subscription (by ID) and displays an admin notice indicating whether it is active, not active, or not found. It’s useful for debugging or confirming the status of a known subscription directly from the WordPress admin area.
wcs_is_sub_active_notice.php content:
<?php
function wcs_is_sub_active_notice() {
$sub_id = 445;
if ( wcs_get_subscription( $sub_id ) ) {
if ( wcs_get_subscription( $sub_id )->get_status() == 'active' ) {
$class = 'notice notice-error';
$message = __( '445 is ACTIVE', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
} else {
$class = 'notice notice-error';
$message = __( '445 is NOT-ACTIVE', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
} else {
$class = 'notice notice-error';
$message = __( 'NULL', 'sample-text-domain' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
}
add_action( 'admin_notices', 'wcs_is_sub_active_notice' );
Increase Variation Threshold For AJAX Dropdowns
↑ Back to topThis snippet raises the variation limit for WooCommerce’s AJAX-powered variation dropdowns to 500. It ensures product variation options continue to load smoothly via AJAX, even for products with a large number of variations.
wc_increase_variation_threshold.php content:
<?php
function wc_increase_variation_threshold() {
return 500;
}
add_filter( 'woocommerce_ajax_variation_threshold', 'wc_increase_variation_threshold' );
Questions and Support
↑ Back to topSomething missing from this documentation? Do you still have questions and need assistance?
- Have a question about a specific extension or theme you’d like to purchase? Use our Contact us page to get answers.
- Have you already purchased this product and need some assistance? Get in touch with a Happiness Engineer via the WooCommerce.com Support page and select this product name in the “Product” dropdown.