// 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;
}
Shyam Benegal - Ram Asrey Sweets
ramasreyfoods@gmail.com +919454512700, 0522-4006000 Hazratganj, Lucknow Opens at 08:00am
Shyam Benegal is a well-known and renowned Indian director and screenwriter. We had the pleasure of serving him Ram Asrey’s traditional and exclusive products in the mid nineteenth century when he was in Lucknow in relation to a work related agenda. We were more than delighted to receive praise and blessings from this eminent personality of Indian cinema.