// Hook to restrict shipping based on product and destination postcode
add_filter('woocommerce_package_rates', 'restrict_shipping_by_product_and_postcode', 10, 2);
function restrict_shipping_by_product_and_postcode($rates, $package) {
// Replace '123456' with the postcode of Lucknow
$lucknow_postcode = '226022';
// Check if the destination postcode is different from Lucknow
if ($package['destination']['postcode'] != $lucknow_postcode) {
// Check if there are restricted products in the cart
$restricted_products = array(9651); // Replace with the IDs of the restricted products
foreach ($package['contents'] as $item_id => $values) {
$product_id = $values['product_id'];
if (in_array($product_id, $restricted_products)) {
// If any restricted product is found, unset all shipping methods
$rates = array();
break;
}
}
}
return $rates;
}
UTTAR PRADESH TOURISM - Ram Asrey Sweets
ramasreyfoods@gmail.com +919454512700, 0522-4006000 Hazratganj, Lucknow Opens at 08:00am
“Malai ki Gilori: Whether you are fond of sweets or not, the luscious malai ki giloris will make you love them! Savour it fusing in your mouth within moments and you will surely ask for more. You will find these giloris at Ram Asrey, a popular sweet shop of Lucknow.”