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_get_availability', 'custom_override_woocommerce_show_in_stock', 10, 2 ); | |
function custom_override_woocommerce_show_in_stock( $availability, $product ) { | |
if ( ! $product->managing_stock() && $product->is_in_stock() ) { | |
$availability['availability'] = __( 'In Stock', 'woocommerce' ); | |
} | |
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 | |
if ( is_plugin_active( 'woocommerce-brands/woocommerce-brands.php' ) ) { | |
add_action( 'woocommerce_shop_loop_item_title', 'add_brands_to_product_loop' ); | |
// Add brands to product loop. | |
function add_brands_to_product_loop() { | |
$terms = get_the_terms( get_the_ID(), 'product_brand' ); | |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { | |
$term = join( ', ', wp_list_pluck( $terms, 'name' ) ); |
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 | |
/* | |
* The shortcode is [top_level_product_categories_list] | |
*/ | |
add_shortcode('top_level_product_categories_list', 'wc_shortcode_top_level_product_categories_list'); | |
function wc_shortcode_top_level_product_categories_list() { | |
ob_start(); | |
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 | |
/* | |
* Access to downloadable files associated with a subscription will, by default, expire | |
* when the subscription is no longer "active" or "pending-cancel". | |
* https://woocommerce.com/document/subscriptions/faq/#section-39 | |
* This snippet overrides that behavior to allow access as per the Download Expiry settng | |
* when the subscription status is "cancelled" | |
*/ |
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 | |
/* | |
* By default, WooCommerce Subscriptions will calculate the next payment date for a subscription from the time of the last payment. | |
* This snippet changes it to calculate the next payment date from the scheduled payment date, not the time the payment was actually processed. | |
*/ | |
add_filter( 'wcs_calculate_next_payment_from_last_payment', '__return_false' ); |
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
// Enable subscription-related emails on a staging site | |
if ( ! defined( 'WCS_FORCE_EMAIL' ) ) { | |
define( 'WCS_FORCE_EMAIL', true ); | |
} |
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 | |
// Sets when the session is about to expire | |
add_filter( 'wc_session_expiring', 'woocommerce_cart_session_about_to_expire'); | |
function woocommerce_cart_session_about_to_expire() { | |
// Default value is 47 | |
return 60 * 60 * 47; | |
} |
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
add_filter( 'wcpv_vendor_slug', 'change_product_vendors_slug' ); | |
function change_product_vendors_slug() { | |
return 'your-new-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
add_filter( 'wc360_js_playspeed', 'adjust_play_speed_for_wc360' ); | |
function adjust_play_speed_for_wc360( $speed ) { | |
return 750; | |
} |