Add set expired subscription to active

// ✅ Add admin submenu under “Subscriptions” add_action( ‘admin_menu’, function() { add_submenu_page( ‘woocommerce’, ‘Manual Reactivation’, ‘Manual Reactivation’, ‘manage_woocommerce’, ‘manual-reactivation’, ‘render_manual_reactivation_page’ ); }); // ✅ Render page content function render_manual_reactivation_page() { ?> Manual Reactivation of Subscription Subscription ID: Next Payment Date:Continue reading

Change active bacs subscription amount

add_action(‘init’, function() { if ( ! current_user_can(‘manage_woocommerce’) ) return; $subscription_id = 56904; // change this to the actual subscription ID $new_price = 3; // the new recurring amount $subscription = wcs_get_subscription($subscription_id); if ( ! $subscription ) { error_log(“❌ Subscription $subscription_id…Continue reading

Automatically Add Store Credit on Card Subscription Renewal

function add_store_credit_on_subscription_renewal_card($order_id) { $logger = wc_get_logger(); $log_context = array(‘source’ => ‘store-credit-renewal-card’); $order = wc_get_order($order_id); if (!$order) { $logger->error(“Store Credit Error: Order {$order_id} not found.”, $log_context); return; } // Skip BACS orders (handled by the other snippet) if ($order->get_payment_method() === ‘bacs’)…Continue reading

Bacs Matcher Page

// Add admin submenu under WooCommerce add_action(‘admin_menu’, function () { add_submenu_page( ‘woocommerce’, ‘BACS Matcher’, ‘BACS Matcher’, ‘manage_woocommerce’, ‘bacs-matcher’, ‘render_bacs_matcher_page_v2’ ); }); if (!function_exists(‘render_bacs_matcher_page_v2’)) { function render_bacs_matcher_page_v2() { echo ‘ BACS Account Matcher ‘; // Handle saving matches if (isset($_POST[‘save_matches’]) &&…Continue reading

BACS reconciliation admin

add_action(‘admin_menu’, function () { add_submenu_page( ‘woocommerce’, ‘BACS Reconciliation’, ‘BACS Reconciliation’, ‘manage_woocommerce’, ‘bacs-reconciliation’, ‘render_bacs_reconciliation_page’ ); }); function render_bacs_reconciliation_page() { echo ‘ BACS Reconciliation ‘; echo ‘ ‘; echo ‘ ‘; echo ‘ Start date ‘; echo ‘ End date ‘; echo…Continue reading

Notify if stock arrives that is backordered 2.0

add_action(‘woocommerce_product_set_stock’, function($product) { if (!is_a($product, ‘WC_Product’)) return; $logger = wc_get_logger(); // — detect context — if (defined(‘REST_REQUEST’) && REST_REQUEST) { $context = ‘REST API (likely Slynk)’; } elseif (wp_doing_ajax()) { $context = ‘AJAX’; } elseif (wp_doing_cron()) { $context = ‘Cron…Continue reading

Mark card renewal orders as complete

add_action(‘woocommerce_subscription_renewal_payment_complete’, function($object) { $logger = wc_get_logger(); $log_context = array(‘source’ => ‘auto-complete-renewal’); // Handle subscription objects vs order IDs $order = null; if (is_a($object, ‘WC_Subscription’)) { $logger->info(“Received subscription {$object->get_id()}, fetching last renewal order”, $log_context); $order = $object->get_last_order( ‘renewal’ ); if (!$order)…Continue reading

Colour code the orders admin

add_filter(‘post_class’, function($classes, $class, $post_id) { if (get_post_type($post_id) !== ‘shop_order’) return $classes; $order = wc_get_order($post_id); $logger = wc_get_logger(); $context = [‘source’ => ‘order-row-highlighting’]; // — Subscriptions (parent or renewal) — if (function_exists(‘wcs_order_contains_subscription’) && wcs_order_contains_subscription($order, ‘any’)) { $classes[] = ‘order-subscription’; } //…Continue reading

Remove shipping from completed order

add_action(‘init’, function() { if (!is_admin()) return; $order_id = 65588; // Replace this with the actual order ID $order = wc_get_order($order_id); if (!$order) { error_log(“Order $order_id not found.”); return; } $removed = []; foreach ($order->get_items(‘shipping’) as $item_id => $item) { $method_id…Continue reading

Adjust Owl carousel for mobile books view

add_action(‘wp_enqueue_scripts’, function () { // This runs after the theme’s main script (theme-js) to override Owl Carousel config wp_add_inline_script(‘theme-js’, ” jQuery(window).on(‘load’, function () { var \$carousel = jQuery(‘.featured-products ul.products’); if (\$carousel.length && \$carousel.data(‘owl.carousel’)) { // Destroy the existing Owl instance…Continue reading