Skip to main content

Posts

How to remove woocommerce checkout fields?

Ans :    In WooCommerce there is no built-in function to remove checkout fields and billing details heading from checkout page. So we remove these fields pragmatically using hooks supplied by Woocommerce. What you need to do is open your child theme's functions.php file and write the following code. functions.php // Removing checkout fields add_filter( 'woocommerce_checkout_fields' , 'wc_remove_checkout_fields' ); function wc_remove_checkout_fields( $fields ) {     unset($fields['billing']['billing_first_name']);     unset($fields['billing']['billing_last_name']);     unset($fields['billing']['billing_company']);     unset($fields['billing']['billing_address_1']);     unset($fields['billing']['billing_address_2']);     unset($fields['billing']['billing_city']);     unset($fields['billing']['billing_postcode']);     unset($fields['bil...
Write a program in C to print the larger of three numbers  with  t he  help of   algorithm and flowchart. Algorithm: Step 1: Start Step 2: Read n1, n2, n3 Step 3: If n1>n2 and n1>n3 then                 Display “n1 is greater than n2 and n3”                 Else                 Goto step 4. Step 4: If n2>n1 and n2>n3 then                 Display “n2 is greater than n1 and n3”                 Else                 Goto step 5. Step 5: If n3>n1 and n3>n2 then  ...

How to add TextBox to display product price inside woocommerce single product page?

Adding TextBox to display product price inside woocommerce single product page -  Step -1 :  Write the following code inside your functions.php file -  add_action( 'woocommerce_after_add_to_cart_quantity', 'woocommerce_total_product_price', 31 ); function woocommerce_total_product_price() {       ?>      <input type="hidden" class="product-currency" value=<?php echo get_woocommerce_currency_symbol()?> />     <input type="text" id="product_total_price" readonly="readonly">     <input type="hidden" id="calculate_product_total_price" >     <?php } Step - 2 :  Create a js file as "test.js" and write the following code inside "test.js" file - jQuery(function($) {     /* Clearing product price textbox and hidden price textbox when clear link is clicked */   $('.reset_variations').on('click...

Bubble Sort Algorithm in C

BUBBLE SORT  : Bubble sort is one of the simple sorting algorithm that sometimes referred to as sinking sort . It compares each pair of adjacent element and swaps them if they are in wrong order. Let us take an unsorted list of elements and sort them by applying this algorithm. Elements of the array -                                                                 9        3        6       7       1        5 Pass 1:                    9       3       6       7       1        5       arr[0] > arr[1], Exchange             ...

Selection Sort Algorithm in C

SELECTION SORT : There are several methods for sorting an array, selection sort is one of them. Let us take an unsorted list of elements and sort them by applying this algorithm. Elements of the array -                                                                   9        3        6       7       1        5 Pass 1:               9        3       6       7       1        5                 arr[0] > arr[1],  Exchange               3        9      ...

How to customize header part of storefront theme in wordpress?

Solution:  You can easily customize storefront theme from functions.php of storefront child theme. With the help of storefront_header hook you can do that. The following code is used to remove storefront header default features- add_action("after_setup_theme", "storefront_child_header_remove"); function storefront_child_header_remove() {     remove_action("storefront_header","storefront_site_branding",20);     remove_action("storefront_header","storefront_secondary_navigation",30);     remove_action("storefront_header","storefront_product_search",40);     remove_action("storefront_header","storefront_primary_navigation_wrapper",42);     remove_action("storefront_header","storefront_primary_navigation",50);     remove_action("storefront_header","storefront_header_cart",60);     remove_action("storefront_header","storefront_pri...

How to remove breadcrumb from woocommerce theme that uses storefront?

Solution: To remove breadcrumb and sidebar from your woocommerce child theme that uses storefront theme,  write the following code in functions.php. add_action (' after_setup_theme ',' removing_bredcrumb_sidebar '); function removing_bredcrumb_sidebar () { remove_action('storefront_content_top','woocommerce_breadcrumb',10);         remove_action( 'storefront_sidebar','storefront_get_sidebar',10 ); }

How to auto update woocommerce cart when quantity is changed?

Solution:  It is very easy to update your woocommerce cart page automatically when quantity is changed. To do this open your functions.php file and write down the following code. add_action ( ' woocommerce_after_cart ', ' mycart_auto_update ' ); function  mycart_auto_update () {     echo '<script>     jQuery(document).ready(function($)     {           $(".woocommerce-cart-form").find(".qty").on("change", function()               {                     upd_cart_btn.trigger("click");              });     });     </script>';  }

Tricky Question in C

Q. What will be output if you execute the following c code? void   main (){    int  i=10;    static   int  value=i;    if (value==i)       printf( "Both are Equal" );    else   if (x>i)       printf( "value is Greater than i" );    else       printf( "value is Less than i" ); } (a)  Both are Equal (b)  value is Greater than i (c)  value is Less than i (d) Compiler error (e) None of above Ans:   (d) Explanation: As we know that static variables are load time entity while auto variables are run time entity. Son it is not possible to initialize any load time variable by the run time variable. In the above example i is a run time variable while x is load time variable.

C program on Android phone

Q. How to run any C program on your Android Phone? It is possible to run any C program on your Android Smart Phone. Please follow the following steps to run C program on your phone. Steps  : 1. At first press menu button in your Android phone then select Play store . 2. Now type CppDroid on search box and then press ok. 3. After that install CppDroid app from play store. ( your phone is ready to run any C program on your Android   Phone. ) 4. Now close play store and again press menu button. 5. Select CppDroid from the menu window( first time it will download some of the file after opening this app ) now write any    C program to run on your phone.

Algorithm, Flowchart and Program code to print the larger of two numbers

       Q. Write a program in C to print the larger of two numbers with                t he  help of   algorithm and flowchart.        Algorithm:        Step 1: Start       Step 2: Read a, b .        /* a, b two numbers */        Step 3: If a>b then        /*Checking */                       Display “a is the largest number”.                   Otherwise                       Display “b is the largest number”.   Step 4: Stop.     Flowchart  :     Program:       Output: