// تعديل سعر Flexible Shipping حسب المنطقة add_filter('woocommerce_package_rates', function($rates, $package) { $chosen_area = WC()->session->get('chosen_shipping_area'); if (!$chosen_area) return $rates; $areas_costs = [ 'Century City new cairo' => 30, 'Dar Masr elandaos' => 35, 'El Katameya' => 35, 'El Rehab City 1' => 50, 'Emaar Mivida 2' => 45, 'La fontain elsharbatly compound' => 55, 'Jannah compound' => 30, 'Industrial area New cairo' => 30, 'Tagammoa 3 - 2nd District' => 45, 'Tagammoa 5 - 90 St. Companies' => 40, 'Tagammoa 5 - El Lotus El Shamaleya' => 50, 'Tagammoa 5 - El Narges 3 - 1' => 40, 'Tagammoa 3' => 40, 'Tagammoa 5 - El Narges 1' => 40, 'Tagammoa 5 - El Narges 1 - 2' => 50, 'Tagammoa 5 - Banks Center' => 50, 'Tagammoa 3 - 3rd District' => 45, 'Tagammoa 5 - El Narges 2' => 50, 'Tagammoa 3 - 4th District' => 50, 'Tagammoa 5 - AUC' => 45, 'Tagammoa 5 - El Narges Buildings - 1' => 40, 'Sakan Masr compound' => 40, 'Tagammoa 5 - Diplomates' => 40, 'Tagammoa 5 - Hay 3' => 50, 'Tagammoa 5 - Hay 4' => 50, 'The Icon Residence' => 25, 'New Narges' => 40, 'Tagammoa 5 - South Investors' => 40, 'Tagammoa 5 - North Investors Extension 2' => 60, 'Tagammoa 5 - Sodic' => 40, 'Tagammoa 5 - North Investors' => 60, 'Tagammoa 5 - North Investors-2' => 60, 'Tagammoa 5 - North Investors Extension' => 60, 'Tagammoa 5 - Abo AL Houl' => 25, 'Tagammoa5 - El Lotus El Ganoubeya' => 45, 'Tagammoa 5 - El Narges 3' => 60, 'Tagamoaa 3' => 40, 'Tagammoa 5 - Hay 2' => 55, 'South investors area 2' => 50, 'Tagammoa 5 - West Arabella' => 45, 'Tagammoa 5 - Al Diyar Compound' => 45, 'Tagammoa 5 - El Narges 4' => 40, 'Tagammoa 3 - El Shabab' => 45, 'Tagammoa 5 - 90 St. Companies - 2' => 60, 'Tagammoa 5 - Fountain Park' => 50, 'Tagammoa 5 - Les Rois Compound' => 40, 'Azad' => 35, 'La Mirada' => 40, 'Tagammoa 5 - El Narges 4 - 1' => 45, 'Tagammoa 5 - El Narges Buildings' => 40, 'Tagammoa 5 - Emaar Mivida' => 45, 'Tagammoa 5 - Hay 5' => 60, 'Tagammoa 5 - El Narges 5,6,7' => 45, 'Tagammoa 5 - El Narges 8' => 40, 'Tagammoa 5 - Banafseg 9,10,11,12' => 60, 'Mountain View Executive' => 35, 'High land Park' => 30, ]; foreach ($rates as $rate_id => $rate) { if ($rate->method_id === 'flexible_shipping' && isset($areas_costs[$chosen_area])) { $rates[$rate_id]->cost = $areas_costs[$chosen_area]; } } return $rates; }, 20, 2);