LATEST ARTICLES

Remove password field from woocommerce checkout

0

Woocommerce uses a password field in the checkout form to create users. But sometimes we need to remove the password field from woocommerce checkout form. Let’s see how to remove password field from woocommerce checkout page.

By default, woocommerce password field looks like this picture.

Woocommerce default password field

We don’t need to use any hook or add any PHP functions to remove the field. All we have to do is navigate to Woocommerce > Settings > Accounts & Privacy. 

On that page, simply check this field ‘When creating an account, automatically generate an account password’.

If you are still having trouble removing the field, please contact me.

Display gravity forms entries in a template without plugin

4

Gravity forms is a great plugin when it comes to creating a form. It can create any kind of form like a simple contact form or complicated conditional form. Today I will show you how to display gravity forms entries in a template.

Here’s a simple form I just created with 4 fields. display gravity forms entries

We will create a table to show the data. Add this code in the template where you want to display the entries.



<table class="gform-entries">

<thead>

<tr>

<th>First Name</th>


<th>Last Name</th>


<th>Phone</th>


<th>Email</th>

</tr>

</thead>


<tbody>
<?php $form_id = '2'; $entry = GFAPI::get_entries( $form_id ); foreach ($entry as $key ) { $entry_last_name = $key['1']; $entry_first_name = $key['2']; $entry_phone = $key[4]; $entry_email = $key[3]; ?>

<tr>

<td class="first-name"><?php echo $entry_last_name;?></td>


<td class="last-name"><?php echo $entry_first_name;?></td>


<td class="phone"><?php echo $entry_phone;?></td>


<td class="email"><?php echo $entry_email;?></td>

</tr>

<?php } ?>
</tbody>

</table>

Now, all you have to do is replace the form id with your form id. Just change the id of $form_id variable and the $key[”] with your own form. The entries will be displayed like the picture. You can change the design as you like.

display gravity forms entries

You can display all the data that is in the database by print_r the array by the following.

<pre><?php print_r($entry);?></pre>

Please post a comment if you find this helpful. And ask me if you still have any questions. You can also hire me to do your job.

Disable or hide php warnings in wordpress

2

PHP warnings and errors are different. When PHP errors crash or break the site the PHP warnings just display some annoying error reports. We can easily disable PHP warnings on the WordPress website.

Here is an example of a PHP warning. If you see something like this then I will show you how to hide the warnings.

disable php warning in wordpress website

Open the wp-config.php and find the line /* That's all, stop editing! Happy publishing. */

Add this code before that line.

define( 'WP_DEBUG', false );
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG_DISPLAY', false);

It will disable the PHP warnings from your WordPress website.

Please post a comment if you find this helpful. And ask me if you still have any questions. You can also hire me to do your job.

Change coupon notice position in woocommerce checkout page

In this post, I will show you how to change or relocate coupon notices position in woocommerce checkout page.

As you can see I have moved the coupon field from top to the right side of the checkout page. And the coupon notices are displaying at the top. But I want to display the coupon notices right above the coupon field. Let’s see how can we do that.

change-coupon-notice-position-woocommerce-filed
 

The notices are showing from the wocoommerce default ‘checkout.min.js’ file. As there is no hook to change the coupon notice position, we will have to edit the js file.

First of all, we will copy the checkout.js from the directory plugins/woocommerce/assets/js/frontend/checkout.js to our theme’s js/checkout.js folder.

Open the checkout.js from our theme that we just added and find line no. 618 where it says

$form.before( code );

Replace it with

$('p.coupon-text').after( code );

It will look like the picture.

 

checkout-js-code

In the last step, we will dequeue the default js file and enqueue our edited js file.


//Change checkout coupon notice position
function replace_checkout_default_scripts() {

/**
* Remove default woocommerce checkout scripts.
*/
wp_deregister_script( 'wc-checkout' );
wp_dequeue_script( 'wc-checkout' );

/**
* Add own modify scripts.
*/
wp_register_script( 'wc-checkout', get_template_directory_uri() . '/js/checkout.js', array( 'jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n' ), WC_VERSION, true );

if( is_checkout() ) {
wp_enqueue_script( 'wc-checkout' );
}
}

add_action( 'wp_enqueue_scripts', 'replace_checkout_default_scripts', 20 );

Now all the coupon notices will be displaying right above the coupon field. And all other notices will be displaying at the top as usual.

How to update php version from ipage hosting

7

In this post, you will learn how to update the PHP version from iPage hosting. Changing the PHP version from iPage is very easy. All you have to is log in to iPage control panel and click on HOSTING from Header.

update php verion in ipage

Once you are on the Hosting page, you will see all the hosting information. Click on Scripting Config from the left sidebar.

update ipage php verion

Now you can see all the scripting configurations. Click on Manage PHP Scripting from PHP Scripting.

ipage php version

Click on Change PHP Version from the ACTIONS section.

ipage php update

Then select the PHP version you want from the dropdown and click the Set Version button.

update php version

If you liked the article, then please leave a comment. And please contact me or leave a comment if you face any issues.

How to remove invalid menu items in wordpress

6

In this article, I am going to show you how you can easily remove invalid menu items from the WordPress website.

If we remove any page from WordPress website it goes to the trash. And if that page was added in the navigation menu they still display as invalid menu items in the backend menu page. That is not a problem as long as the removed pages aren’t showing in the frontend.

The problem is when we want to remove the invalid menu items from the selected menu. There is no option to remove all the invalid menu items easily. You have to remove every single menu item one by one and that is so time consuming and boring.

So, I created a simple plugin to remove the invalid menu items in one click. The plugin is called Remove invalid menu items. All you have to do is install and activate the plugin then go to the navigation menu page. In the menu edit page, you will find a button called ‘Delete invalid menu items’ beside the Save menu button. Just click on the button and all the invalid menu items will be removed.

fopen no such file or directory error after migrating wordpress site

0

If you notice fopen no such file or directory error after migrating WordPress site, then you can try these solutions.

The error looks something like this:

Warning: fopen(/home/content/24/8561424/html/ssecurity/wp-content/plugins/woo-nmi-three-step/woocommerce-nmi-three-step.php): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-includes\functions.php on line 4848
Warning: fread() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\wordpress\wp-includes\functions.php on line 4851
Warning: fclose() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\wordpress\wp-includes\functions.php on line 4854

You can see that the page is trying to open a file that is not available. If you see carefully, you will notice that the directory is not exactly the current directory where your wordpress is installed. Actually, the directory link of your old server is still saved in the database. That’s why you are seeing the fopen no such file or directory error.

Now let’s solve this problem. I will show you 3 ways to fix the issue.

Solution 1: Deactivate/Reinstall the plugin to fix fopen no such file or directory error

Most of the time the error will be fixed if you just deactivate/reinstall the plugin that is causing the error. What it will actually do is refresh the directory path saved in the database with the current path.

Solution 2: Edit Database to fix fopen no such file or directory error

Go to PhpMyAdmin and select the database you are using. Please backup the database before changing anything. Find the fs_accounts from the option_name column in the ‘options’ table. Edit the ‘fs_accounts’ and you will see the old path is saved there. Just replace the path with the current directory path. Now the fopen no such file or directory error should be fixed.

Solution 3: Remove the ‘fs_accounts’

fopen no such file or directory error

If the first two solution doesn’t work. You can try by removing the ‘fs_accounts’ row from the table. But in this case, you might have to add some of your saved settings will be lost. You will have to add them again.

Please asked me any questions if you have. And add a comment if it really helps you. Also, let me know if you have any better solution. And contact me if you still face the issue.

Add checkbox before checkout with Paypal button on Woocommerce cart page

0

It’s been almost year I am working for a client who wants to add a checkbox before “Checkout with Paypal” button on Woocommerce cart page. Woocommerce normally adds a checkbox before the submit button on checkout page but not on the cart page.

When he asked me to add the checkbox I did a couple of google search and found that there is no option to add this from the plugin settings or any hook. So, I decided to add the checkbox by adding code. I am going to share what exactly I did to add the checkbox.

The idea was adding a checkbox before the button and disable the button until the checkbox is checked.

This is the code I added to in a js file.

jQuery(document).ready(function(){
jQuery('a#woo_pp_ec_button').before('&lt;div class="paypal_checkbox_wrapper"&gt;&lt;input type="checkbox" id="paypal_c_checkbox"/&gt;&lt;label for="paypal_c_checkbox"&gt;I\'ve read and accept the &lt;a href="/privacy-policy"&gt;Privacy Policy&lt;/a&gt; and &lt;a href="/terms-conditions/"&gt;Terms &amp;amp; Conditions&lt;/a&gt;&amp;nbsp;&lt;abbr class="required" title="required"&gt;*&lt;/abbr&gt;&lt;/label&gt;&lt;/div&gt;&lt;p class="alert"&gt;Please accept the Terms and Conditions.&lt;/p&gt;');
jQuery('a#woo_pp_ec_button').after('&lt;div class="disable_overlay"&gt;&lt;/div&gt;');
jQuery('#paypal_c_checkbox').click(function(){
jQuery('.disable_overlay').toggle();

});
jQuery('.disable_overlay').click(function(){
jQuery('.wcppec-checkout-buttons.woo_pp_cart_buttons_div .alert').show();
});
});

First of all, I added a checkbox and an error message before the button. Then I hide the error message with CSS so that it only display when the checkbox is not checked. Then I made a CSS overlay to disable the button until it is checked. And when the checkbox is clicked the overlay will be hidden so that the button is clickable.

I have also added this code to design the checkbox, overlay and error message.

label[for="paypal_c_checkbox"]{
display: inline-block;
padding-left: 5px;
}
.disable_overlay{
position: absolute;
text-align: center;
width: 100%;
margin-top: -46px;
display: block;
height: 48px;
cursor: pointer;
}
.wcppec-checkout-buttons.woo_pp_cart_buttons_div .alert{
width: 70%;
margin: auto;
display: none;
}

You might have to change the CSS according to your theme design. This the easiest solution I have found and I hope it will help others. If you have any other idea please let me know so that I can try. Please comment if you have any question.