?php /** * ru-product-enhancements.php — RetailUnlimit Product Page Improvements * ====================================================================== * Adds: * 1. Stock / availability badge with shipping estimate * 2. B2B Quote Request button (next to Add to Cart) * 3. Warranty & Return policy trust snippet */ if (!defined('ABSPATH')) exit; // ── 1. STOCK / AVAILABILITY BADGE ──────────────────────────────────────────── // Fires just before the price (priority 9 = just before default price at 10) add_action('woocommerce_single_product_summary', 'ru_availability_badge', 9); function ru_availability_badge() { global $product; if (!$product) return; $stock_status = $product->get_stock_status(); $stock_qty = $product->get_stock_quantity(); $manage_stock = $product->managing_stock(); if ($stock_status === 'instock') { if ($manage_stock && $stock_qty !== null && $stock_qty <= 5) { // Low stock $badge_html = '
Only ' . intval($stock_qty) . ' left — Estimated Shipping: 2-5 Business Days
'; } else { // In stock $badge_html = '
In Stock — Estimated Shipping: 1-3 Business Days
'; } } elseif ($stock_status === 'onbackorder') { $badge_html = '
Available for Backorder — Additional lead time may apply. Contact us for delivery estimates.
'; } else { $badge_html = '
Out of Stock — Contact us for availability and alternative sourcing options.
'; } // Check for special order meta $special_order = get_post_meta(get_the_ID(), '_special_order', true); if ($special_order) { $badge_html .= '
Special Order — Non-cancellable once placed
'; } echo $badge_html; } // ── 1b. SHARED FULFILLMENT-STATE MAPPING (Issue #108) ──────────────────────── // Reusable state classifier — #109 Product Fulfillment State vocabulary. // Used by category/search card badges (ru_card_availability_badge). // Deliberately excludes shipping-estimate copy and Special Order status; // both are surface-specific rendering concerns handled separately. // ru_availability_badge() (single-product page) is NOT yet refactored to // use this function — that is explicitly deferred (see #108 follow-on). function ru_map_to_fulfillment_state($product) { $stock_status = $product->get_stock_status(); $stock_qty = $product->get_stock_quantity(); if ($stock_status === 'onbackorder') { return array( 'state' => 'available_for_backorder', 'label' => 'Available for Backorder', 'class' => 'ru-stock-backorder' ); } if ($stock_status !== 'instock') { return array( 'state' => 'out_of_stock', 'label' => 'Out of Stock', 'class' => 'ru-stock-out' ); } if ($product->managing_stock() && $stock_qty !== null && $stock_qty <= 5) { return array( 'state' => 'low_stock', 'label' => 'Only ' . intval($stock_qty) . ' left', 'class' => 'ru-stock-low' ); } return array( 'state' => 'in_stock', 'label' => 'In Stock', 'class' => 'ru-stock-in' ); } // ── 1c. CATEGORY/SEARCH CARD AVAILABILITY BADGE (Issue #108) ───────────────── function ru_card_availability_badge() { global $product; if (!$product) { return; } $info = ru_map_to_fulfillment_state($product); echo '
' . esc_html($info['label']) . '
'; } // ── 2. B2B QUOTE REQUEST BUTTON ─────────────────────────────────────────────── // Fires after Add to Cart button (priority 32 = just after default 30) add_action('woocommerce_single_product_summary', 'ru_b2b_quote_button', 32); function ru_b2b_quote_button() { global $product, $post; $product_name = get_the_title(); $mpn = get_post_meta($post->ID, '_mpn', true); $sku = get_post_meta($post->ID, '_sku', true); $price = $product->get_price(); $product_id = $post->ID; $quote_url = '/b2b-enterprise-quote/?prod_name=' . urlencode($product_name) . '&mpn=' . urlencode($mpn) . '&sku=' . urlencode($sku) . '&price=' . urlencode($price) . '&product_id=' . $product_id; echo '
Request B2B Quote
'; } // ── 3. WARRANTY & RETURN POLICY TRUST SNIPPET ──────────────────────────────── // Fires after the Add to Cart area (priority 35) add_action('woocommerce_single_product_summary', 'ru_trust_snippet', 35); function ru_trust_snippet() { echo '
Manufacturer Warranty All products include full manufacturer warranty
30-Day Returns Hassle-free returns on eligible items
Secure Checkout SSL encrypted · Net terms available for B2B
Fast Shipping Same/next business day dispatch
'; } // ── CSS FOR ALL THREE ELEMENTS ──────────────────────────────────────────────── add_action('wp_head', 'ru_product_enhancements_styles'); function ru_product_enhancements_styles() { if (!(is_product() || is_shop() || is_product_category() || is_product_tag())) { return; } echo ''; } B2B Enterprise Quote - RetailUnlimit.com
Dark Light

B2B Enterprise Quote

Enterprise Hardware Catalog

High-value enterprise equipment — request a custom quote with volume pricing, financing, or leasing options.

📦
HPE

HPE MSA 2070 10GBASE-T iSCSI LFF Storage

Starting at $14,093.26
📦
Vertiv

*FDONLY ITEM DUE TO LITHIUM* Single-phase UPS 1.0 Output Power Factor Lowest TCO Full-color…

Starting at $14,139.25
📦
APC

(2) YEAR ON-SITE WARRANTY EXTENSION FOR (1) SYMMETRA PX UPS 100KVA 100 AND/OR PD

Starting at $14,149.99
📦
HPE

HPE Aruba Networking 6300M 48p 10M/100M/1G Class4 PoE 4p SFP56 50G TAA Switch TAA…

Starting at $14,173.07
📦
Cisco

REFURBISHED ITEM – Cisco SPA-8X1GE-V2 8-Port Shared Port Adapter, 1 – 8 x Expansion…

Starting at $14,214.82
📦
APC

INFRASTRUXURE MODULAR IT POWER DISTRIBUTION UNIT 144KW 400A 208V 72 POLE 300MM R

Starting at $14,264.99
📦
APC

ASSEMBLY SERVICE 5X8 FOR (1) GALAXY VX 500 SCALABLE TO 1500KVA UPS

Starting at $14,264.99
📦
APC

(1) YEAR ADVANTAGE PLUS SERVICE PLAN FOR (1) SYMMETRA MW 1600KVA

Starting at $14,284.99
📦
HPE

HPE Aruba Networking CX 6400 24p Smart Rate 1G/2.5G/5G/10G Class8 PoE and 4p SFP56…

Starting at $14,292.89
📦
HPE

HPE Aruba 6400 24-port 10Gbase-T and 4-port SFP56 v2 – Switch – L3 –…

Starting at $14,292.89
📦
APC

MODULAR UPS REVITALIZATION SERVICE FOR (1) SYMMETRA LX WITH 5 X SYPM4KP, 4 X…

Starting at $14,379.99
📦
HPE

ARUBA 6400 48P SR5 CL6 POE 4SFP56 V2 MOD PL-WB

Starting at $14,392.15

Explore Equipment Leasing

Spread the cost over 24-60 months. Great for servers, networking equipment, and workstations.

Questions? Call (469) 251-0066 or email sales@retailunlimit.com

SHOPPING CART

close