This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wcopc_not_empty_cart', '__return_true', 100 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcs_disable_report_cache_update() { | |
$cached_report_classes = array( | |
'WC_Report_Subscription_Events_By_Date', | |
'WC_Report_Upcoming_Recurring_Revenue', | |
'WC_Report_Subscription_By_Product', | |
'WC_Report_Subscription_By_Customer', | |
); | |
foreach ( $cached_report_classes as $report_class ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_admin_reports', 'remove_subscriptions_tab', 13, 1 ); | |
function remove_subscriptions_tab( $reports ) { | |
// unset the subscriptions tab | |
unset($reports['subscriptions']); | |
return $reports; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcs_do_not_reduce_renewal_stock( $reduce_stock, $order ) { | |
if ( function_exists( 'wcs_order_contains_renewal' ) && wcs_order_contains_renewal( $order ) ) { // Subscriptions v2.0+ | |
$reduce_stock = false; | |
} elseif ( class_exists( 'WC_Subscriptions_Renewal_Order' ) && WC_Subscriptions_Renewal_Order::is_renewal( $order ) ) { | |
$reduce_stock = false; | |
} | |
return $reduce_stock; | |
} |