Open Daily : 10:00 - 20:00
Call center : 02-714-9555
Line ID : @SLChospital
SLC Online

SLC Online Deal

ดูดีลออนไลน์
ตรวจสอบการสั่งจอง/ยืนยันการชำระเงิน

Hot Deals !!!

Online Payment 21,950.-

Online Payment 21,950.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 21,950.-

Online Payment 21,950.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 49,500.-

Online Payment 49,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 1,900

Online Payment 1,900

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 3,596

Online Payment 3,596

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 59400.-

Online Payment 49,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 59400

Online Payment 28,900.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 178,500.-

Online Payment 178,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 82,500

Online Payment 82,500

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Voucher 269,000

Online Voucher 9,900

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 16,400.-

Online Payment 16,400.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 9,900.-

Online Payment 9,900.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>

Special Deal

Online Payment 21,950.-

Online Payment 21,950.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 21,950.-

Online Payment 21,950.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 49,500.-

Online Payment 49,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 1,900

Online Payment 1,900

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 3,596

Online Payment 3,596

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 59400.-

Online Payment 49,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 59400

Online Payment 28,900.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 178,500.-

Online Payment 178,500.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 82,500

Online Payment 82,500

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Voucher 269,000

Online Voucher 9,900

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 16,400.-

Online Payment 16,400.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>
Online Payment 9,900.-

Online Payment 9,900.-

<?php
// Get WooCommerce product stock
$product = wc_get_product(get_the_ID());
$stock_quantity = $product->get_stock_quantity();
$manage_stock = $product->get_manage_stock();
$stock_status = $product->get_stock_status();

// Check if product manages stock or just uses in-stock/out-of-stock
if ($manage_stock && $stock_quantity !== null) {
    // STOCK MANAGED PRODUCTS
    // You can set max_stock as a custom field or use a fixed value
    $max_stock = get_post_meta(get_the_ID(), '_max_stock', true);
    if (!$max_stock) {
        $max_stock = 50; // Default max stock (changed to 50 as requested)
    }
    
    $stock_percentage = ($stock_quantity / $max_stock) * 100;
    $stock_percentage = max(0, min(100, $stock_percentage)); // Keep between 0-100%
    
    // Handle zero stock case
    if ($stock_quantity == 0) {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: ' . $stock_percentage . '%;">';
        echo '            <div class="stock-text">' . $stock_quantity . ' สิทธิ์สุดท้าย</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
} else {
    // NON-STOCK MANAGED PRODUCTS (Simple In-Stock/Out-of-Stock)
    if ($stock_status === 'instock') {
        // In Stock - Red bar, full width
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%;">';
        echo '            <div class="stock-text">มีสิทธิ์</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    } else {
        // Out of Stock - Gray bar
        echo '<div class="stock-progress-container">';
        echo '    <div class="stock-progress-bar">';
        echo '        <div class="stock-progress-fill" style="width: 100%; background-color: #cccccc;">';
        echo '            <div class="stock-text" style="color: #666666;">สิทธิ์หมดแล้ว</div>';
        echo '        </div>';
        echo '    </div>';
        echo '</div>';
    }
}
?>