My client was using the Prestashop 1.6 and and getting the authentication error when his visitor wants to create an account. Site is giving the following error: TECHNICAL ERROR: unable to load form. Details: Error thrown: [object Object] Text status: parsererror If your friendly URL option is turn on at backend, sometimes this kind of error… Continue Reading
Code
Hiding Cart Menu Item When Cart is Empty
I had an interesting question from a user who wants to hide the cart item from the menu when cart is empty. This tutorial will only work if you are using the WooCommerce plugin. I added the simple PHP snippets into my functions.php file. Here is the code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<?php //* do not include this line /** * Hiding the cart menu item when cart is empty * * @author Paul * @license GPL 2.0+ */ function paul_nav_menu_items( $items, $menu ) { //* get the cart page id $cart_page_id = get_option( 'woocommerce_cart_page_id' ); if( ! empty( $cart_page_id ) ) { foreach( $items as $key => $item ) { if( $item->object_id === $cart_page_id && WC()->cart->is_empty() ) { unset( $items[ $key ] ); //* removing the cart menu item from list } } } return $items; } add_filter( 'wp_get_nav_menu_items', 'paul_nav_menu_items', 10, 2 ); |
There have a filter wp_get_nav_menu_items which is… Continue Reading
Adding Custom Tabs in WooCommerce Product Details Page
In this tutorial I shall show you how you will add custom tabs with content on WooCommerce product details page. By default there have two tabs: Description & Reviews. I am wanting to add more tabs there. Here is the small PHP snippets for it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<?php //* Don't include this line /** * Displaying custom tab(s) on WooCommerce Product details page * * @author Paul * @license GPL2.0+ * @copyright 2018 */ function paul_cutsom_tabs( $arr ) { $tabs = array( 'my_tab_1' => array( 'callback' => 'callback_for_tab', 'title' => __( 'My Tab 1', 'themeprefix' ) ), 'my_tab_2' => array( 'callback' => 'callback_for_tab', 'title' => __( 'My Tab 2', 'themeprefix' ) ), ); return array_merge( $arr, $tabs ); } add_filter('woocommerce_product_tabs', 'paul_cutsom_tabs', 99 ); function callback_for_tab( $key, $tab ) { if( 'my_tab_1' === $key ) echo '<p>My content for Tab 1</p>'; if( 'my_tab_2' === $key ) echo '<p>My content for Tab 2</p>'; } |
WooCommerce plugin have a filter woocommerce_product_tabs. So you can easily… Continue Reading
[GravityView] Displaying Only Unapproved Entries
Just drop this simple PHP snippets at end of functions.php file. It will fetch all unapproved entries from database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php //* Don't include this line /** * Displaying unapproved entries * * @author Paul * @license GPL2.0+ */ add_filter('gravityview_get_entries', 'paul_awaiting_approval', 1001, 3 ); function paul_awaiting_approval($parameters, $args, $form_id ) { $parameters['search_criteria']['field_filters'][] = array( 'key' => GravityView_Entry_Approval::meta_key, 'value' => '', 'operator' => 'is' ); $parameters['cache'] = false; return $parameters; } |
Update Price Automatically When Quantity Changes on Click
I built a order form using WordPress Contact Form 7 plugin. I’m wanting to update the price automatically when quantity field’d value is changing on mouse click or key press. See the animated image file. You can understand the requirement. I added the simple JS code into my js file. Assume your quantity field name… Continue Reading
Fixing JS Conflict Issue between Older BB plugin & WP 4.9.6
This tutorial will show how you will resolve JS conflicting issue between older version of BB plugin & WP 4.9.6. If you are not renewing the license of Beaver Builder plugin then this trick will help you. But I shall recommend that you will stick with Beaver Builder plugin and renew/buy your own license. Here… Continue Reading
Adding Custom Column at WooCommerce Order List Table
I am running a membership site and wanting to add an new column at my order listing table (WordPress Dashboard). I shall show the member’s age at that column. Here is my steps for this functionality: Creating Custom Field I’m saving the Date of Birth of my customers as a custom field data. I’m using WordPress’s… Continue Reading
Fixing PHP fatal error of WooCommerce Predictive Search Plugin
I updated the old version of WooCommerce Predictive Search Plugin with latest version and it produced the PHP fatal error: Parse error: syntax error, unexpected ‘.’, expecting ‘,’ or ‘;’ in /htdocs/wp-content/plugins/woocommerce-predictive-search/admin/admin-ui.php on line 37 I thought that Plugin’s files are not updated properly. So I downloaded the latest version from WordPress repository and uploaded the… Continue Reading
Enabling the avatar in custom comment types
Few days ago I worked on a project. Client was wanting extra two new types (review & question) at comment form. All things implemented successfully. Only problem was that avatar for review/comment type was not coming at frontend & backend. I researched too much and got that avatar is allowed for comment type only. But… Continue Reading