.wd-term-description.readmore-collapsed{max-height:140px;overflow:hidden;position:relative;transition:max-height 0.5s ease}.wd-term-description.readmore-collapsed::after{content:"";position:absolute;bottom:0;left:0;right:0;height:60px;background:linear-gradient(to bottom,#fff0,rgb(255 255 255))}.readmore-toggle{display:inline-block;margin-top:10px;background:none;border:none;color:#0073aa;font-weight:700;cursor:pointer;font-size:15px;transition:color 0.3s ease}.readmore-toggle:hover{color:#005177}.entry-content p,.entry-content li,.post-content p,.post-content li,.elementor-widget-text-editor p,.elementor-widget-text-editor li,.woocommerce-product-details__short-description p,.woocommerce-product-details__short-description li,.woocommerce-Tabs-panel--description p,.woocommerce-Tabs-panel--description li{text-align:justify}.wp-block-table{font-size:16px;border-radius:15px;padding:0}.wp-block-table table thead{background-color:#1c2857;border-radius:10px!important}.wp-block-table table{border-radius:15px;overflow:hidden;margin-top:0;background-color:#ececec}.wp-block-table table thead tr th{text-align:center;color:#fff}.wp-block-table table tbody tr td{text-align:center}add_filter('woocommerce_package_rates','shayan_control_shipping_methods',20,2);function shayan_control_shipping_methods($rates,$package){if (! is_user_logged_in()){return $rates}$user_id=get_current_user_id();// بررسی اینکه کاربر سفارش قبلی دارد یا نه $customer_orders=wc_get_orders(array('customer_id'=>$user_id,'status'=>array('completed','processing','on-hold'),'limit'=>1,'return'=>'ids',));$has_previous_order=! empty($customer_orders);$new_rates=array();foreach ($rates as $rate_id=>$rate){// تشخیص حمل رایگان (شناسه شامل free_shipping) $is_free=(stripos($rate_id,'free_shipping') !==false);if (! $has_previous_order){// اولین سفارش → فقط روش رایگان if ($is_free){$new_rates[$rate_id]=$rate;break}}else{// سفارش قبلی دارد → فقط روش‌های غیررایگان if (! $is_free){$new_rates[$rate_id]=$rate}}}return $new_rates}