I am trying to change the name of a tab in product page of woocommerce to a different name.
I am trying to find which PHP file has that particular code but I am unable to do that. Have also used plugins like WhatTheFile (it said the product page is loaded from single-product.php, but I couldn't find the html to edit there) and String Locator and they couldn't help even. Please have a look at this video I made and you will better understand my problem.
https://www.dropbox.com/s/bruhb2n83lhfnp6/Code.mp4?dl=0
I am using G5Plus April theme
Thank you
you can add code like this in functions.php of your theme to customize the product description tab title. For more details, Link 1, Link 2
add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
return $tabs;
}
Hope this will helps you.
Related
continue to shipping button text and continue to payment button text
in website woocommerce checkout is there any solution for this pls help me
SH1
Sh2
My website
Cosmeticsonlinehubb.pk
I have tried all plugins but still got not solution for this.
you can change by adding this code to your theme's functions.php
function my_custom_checkout_button_text() {
return 'My Custom Text';
}
add_filter( 'woocommerce_order_button_text', 'my_custom_checkout_button_text' );
You have to change the value which obviously is the My Custom Text to whatever you want.
Friendly, George
I'm creating a website with downloadable products with WooCommerce. When users buy a product and receive an email, I want to customize the table of downloadable products in the email. More specific I only want to change the following:
Only thing I want to do is change 'Downloads' and 'download' to something else…
With some research, I thought I had the answer. I changed some things in order/order-details.php and order/order-downloads.php. But I think I didn't do it correctly.
Can someone tell me what I have to change exactly?
To change the title "Downloads", the right template involved is emails/email-downloads.php line 22
?><h2 class="woocommerce-order-downloads__title"><?php esc_html_e( 'Downloads', 'woocommerce' ); ?></h2>
To change the column label name "Download", you will use the following code:
add_filter('woocommerce_email_downloads_columns', 'custom_email_downloads_columns', 10, 1);
function custom_email_downloads_columns( $columns ){
$columns['download-file'] = __("New name", "woocommerce");
return $columns;
}
Code goes in function.php file of your active child theme (or active theme). Tested and work.
So I have attached an image of my issue.
Basically I followed the instructions on this Stack Overflow question thread right here:
Text under Add to cart (woocommerce)
I posted my question there 5 times and someone kept removing it, so I'm posting it again here. Please advise.
Update: I have already tried the paragraph tag, the break tag, and the pre tag.
You could try this (as you will see this is a CSS styling issue with the margin-top):
add_action( 'woocommerce_after_add_to_cart_button', 'custom_content_after_addtocart_button', 100 );
function custom_content_after_addtocart_button() {
// custom content.
echo '<br/><div><p style="font-size:10px; font-style=italic; margin-top:20px;">(*Contact us for bulk purchase enquiry)</p></div>';
}
Code goes in function.php file of your active child theme (active theme or in any plugin file).
Tested and works. You will get that:
This code will place it nicely below the Add to Cart button :
add_action( 'woocommerce_after_add_to_cart_form','content_after_addtocart', 100 );
function content_after_addtocart() {
// place your content below.
echo 'Hello There !!';
}
First,I know wordpress won't allow you to use template for posts (WooCommerce's product page is built via post). So I look for the Template Hierarchy.
It says there:
single-{post-type}-{slug}.php (Since 4.4). First, WordPress looks for a template for the specific post.
For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.
single-{post-type}.php – If the post type is product, WordPress would look for single-product.php.
single.php – WordPress then falls back to single.php.
singular.php – Then it falls back to singular.php.
index.php – Finally, as mentioned above, WordPress ultimately falls back to index.php.
So I created a template and name it single-product-ccc (ccc is one of my product's slug name), but nothing happened, nothing was affected.
But by creating a template named single-product will affect all of the product pages.
Why is that happening?
I don't get it. Even a single-2313.php (2313 is one post's id) will overwrite the default single.php for that 2313 post.
Why single-product-slug is not working in the same way?
Thanks.
Let me first correct you at one point. You say: "WooCommerce's product page is built via post".
This is not correct. WooCommerce creates a new post type 'product'. You can see all custom posts types that WooCommerce creates here: https://docs.woocommerce.com/document/installed-taxonomies-post-types/
The 'product' post type uses the template single-product.php.
As you say, WordPress Template Hierarchy Docs say that you can create a template for a particular product:
single-{post-type}-{slug}.php (Since 4.4). First, WordPress looks for a template for the specific post. For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.
WooCommerce is a WordPress plugin and as so, it doesn't always follow WordPress rules strictly, and this is one of those cases. But you can use a filter to correct this very easily. In your theme's functions.php simply add:
add_filter( 'template_include', 'custom_single_product_template_include', 50, 1 );
function custom_single_product_template_include( $template ) {
if ( is_singular('product') && (get_the_ID()==30)) {
$template = get_stylesheet_directory() . '/woocommerce/single-product-30.php';
}
return $template;
}
where get_the_ID() is the id of your Product. Now, you can create a new template as for example single-product-30.php
Try adding this in functions.php
function your_theme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'your_theme_add_woocommerce_support' );
and now onwards, you can use woocommerce/single-product.php for customisation
I am trying to do the same thing than in here:
How can review be moved below product description in woocommerce?
Only difference is that I want to move description tab. I've tried to change parameters in example below but I didn't managed to handle it.
add_action('woocommerce_after_single_product_summary', create_function( '$args', 'call_user_func(\'comments_template\');'), 14);
Alternatively, I was trying to move tabs to the top so description tab would be full width (I need it because I'm using big tables see: https://chemiq.sk/produkt/test/).
I've tried to do it with css
.woocommerce-tabs .panel {margin-left: 0px}
because I'm not familiar with creating new hooks, however it was not working. No change afterwards on live website at all.
Both of solutions would work.
At the end I managed it with following code:
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 14 );