WP Fusion – Skip Inactive Subscription Field Sync When Active Subscription Exists

add_filter( ‘wpf_woocommerce_subscription_sync_fields’, ‘rd_wpf_skip_inactive_subscription_sync_when_customer_has_active_subscription’, 10, 2 ); function rd_wpf_skip_inactive_subscription_sync_when_customer_has_active_subscription( $update_data, $subscription ) { if ( ! is_object( $subscription ) || ! method_exists( $subscription, ‘get_status’ ) || ! method_exists( $subscription, ‘get_user_id’ ) || ! method_exists( $subscription, ‘get_id’ ) ) { return $update_data;…Continue reading

Admin Area—Prevent Mouse Scroll Changing Number Inputs

function preventNumberScroll(e) { if (e.target.matches(‘input[type=”number”]’) || e.target.closest(‘input[type=”number”]’)) { e.preventDefault(); } } document.addEventListener(‘wheel’, preventNumberScroll, { passive: false, capture: true }); document.addEventListener(‘mousewheel’, preventNumberScroll, { passive: false, capture: true }); document.addEventListener(‘DOMMouseScroll’, preventNumberScroll, { passive: false, capture: true });Continue reading

[Papa Macros] Rename Default WooCommerce ‘Description’ Tab to ‘Ingredients’

add_filter( ‘woocommerce_product_description_heading’, ‘custom_change_description_heading_for_specific_categories’ ); function custom_change_description_heading_for_specific_categories( $heading ) { global $product; if ( ! is_product() || ! $product instanceof WC_Product ) { return $heading; } // Check if product has either ‘meals’ or ‘snacks’ category if ( has_term( [ ‘meals’,…Continue reading

[Papa Macros] Register Bulk Discount Threshold Reached Message Shortcode

add_shortcode(‘papa_macros_discount_message’, ‘papa_macros_discount_message_shortcode’); function papa_macros_discount_message_shortcode() { if ( ! function_exists(‘WC’) || ! WC()->cart ) { return ”; } $cart = WC()->cart; $manual_subtotal = 0; foreach ( $cart->get_cart() as $item ) { if ( ! isset($item[‘data’]) || ! is_object($item[‘data’]) ) continue; $price…Continue reading