Change Woo-commerce shipping price based on cart product

Put below code in functions.php

function aviweb_flat_rates_cost( $rates, $package ) {

foreach( WC()->cart->get_cart() as $cart_item_key => $values ) {

$_product = $values[‘data’];

if($_product->id == 123){

$rates[‘flat_rate:2’]->cost = 0;



return $rates;

add_filter( ‘woocommerce_package_rates’, ‘aviweb_flat_rates_cost’, 10, 2 );


jQuery validation to allow only numbers OR only characters

Allow only numbers 

if(event.which != 8 && isNaN(String.fromCharCode(event.which))){



Allow Characters with dots

var inputValue = event.charCode;  if(!(inputValue >= 65 && inputValue <= 120) && (inputValue != 32 && inputValue != 0  && inputValue != 46)){




Changing your home network IP address

  1. Open the Control Panel.
  2. Click on the Network and Sharing Center icon.
  3. In the View your active networks section, click the Local Area Connection or Ethernet link.
  4. On the Local Area Connection or Ethernet Status window, click the Properties button.
  5. In the Properties window, select the Internet Protocol Version 6 (TCP/IPv6) or Internet Protocol Version 4 (TCP/IPv4) connection and click the Properties button. The connection you select depends on the type of Internet protocol in use for your Internet or Network connection.
  6. In the Internet Protocol properties window, select the Use the following IP address option if not already selected. Specify the new IP address you want to use. You also need to specify the subnet mask and default gateway.

Create herder & footer pages and include in Drupal 7

  1. You will create two files header.php and footer.php.
  2. Create a folder “include” in your theme directory.
  3. Suppose that your theme directory is “aviweb” sites/all/themes/aviweb. Put header.php and footer.php file in “sites/all/themes/aviweb/include” theme folder.
  4. By using html and php you can write code in header.php and footer.php.
  5. Now you can include both files in page.tpl.php in header area and footer area like PHP.

<?php include_once($theme_path.’/include/header.php’); ?>

<?php include_once($theme_path.’/include/footer.php’); ?>