Price value is printing on shop, category and single product page via get_price_html() function. get_price_html() is a method of WC_Product_Variable class. In this method have a filter “woocommerce_get_price_html”. You can customize the current price structure with this filter as per your requirement. In this tutorial I use this filter woocommerce_get_price_html and add the custom text… Continue Reading
product
Disabling sortable functionality for product attributes at Dashboard
I tried this PHP snippet and added into the functions.php file of my active theme.
[Astra Theme] Displaying the Availability Status Below the Product Title
PHP snippet for free version of Astra theme. Make sure that you are using the child theme of Astra theme. Now open the functions.php file of your child theme and drop the following PHP snippets at end of the file. PHP snippet for PRO version of Astra theme. Make sure that you are using the… Continue Reading
Removes Product Short Description Box from WooCommerce Product Edit Screen
One of the site I do not need the product short description meta box. Therefore I am completely removing this meta box from product add/edit screen. Here is the simple PHP snippets which I added to functions.php file of my theme.
1 2 3 4 5 6 7 8 9 10 11 |
<?php //* Do not include this line /** * Removing the short description meta box */ function paulc_remove_product_short_description_box() { if ( current_user_can( 'edit_post' ) ) { remove_meta_box( 'postexcerpt', 'product', 'normal' ); } } add_action( 'add_meta_boxes', 'paulc_remove_product_short_description_box', 50 ); |
In WooCommerce product short description meta box registered by add_meta_boxes hook with priority… Continue Reading
Displaying Product Description Above The Summary in WooCommerce
Product description is showing at below the product summary. In this tutorial I am showing how you will display it above the product summary section (see the screenshot) Here is the steps You will add all custom PHP codes in your theme’s functions.php file or any other place. It is totally depending on you. Unset… 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