What needs to be done is that the featured image would only appear in the catalog view, but not in a single product view. So basically if an image is set as a featured image it should not be shown as the main image in product page and in should be excluded from thumbnails as well.
I have been looking ofr solution for a long time and tried different many approaches but nothing seems to help:
I have been adding the following to the functions.php:
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_thumbnails', 20 );
as well as all of the solutions in here: Remove featured image from showing on product display page
Theme is Mr. Tailor
Any help or suggestion is much appreciated.
I was searching for this solution like you, and found that your code is almost functioning. Only had to change the number on the second line from 20 to 3, and it's working.
So the code is:
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_thumbnails', 3 );
This will remove featured image in the product page and replaces it with the first thumbnail.
Related
I'm trying to move the title of my products on top (on top of the image) but i'm not sure how to do it... I want the title to be uptop on the product page not the archive page.
I've spent a long time researching about how to do it but nothing seems to work...
Is there a hook to move it ? Maybe change the layout on the product_page.php ?
For better understanding the product template see the default content-single-product.php - https://gist.github.com/dompascal/7825580 and use this visual map - https://www.businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/
In your functions.php file in your active theme add the following:
Solution #1
//First remove default title
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
//Second add your title in thumbnail section - Keep in mind that title will be below the image bcs of the way this hook works
add_action( 'woocommerce_product_thumbnails', 'woocommerce_template_single_title', 5 );
Solution #2
Another way is to place title above all (depends on your design)
//First remove default title
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
//Second add title
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_template_single_title', 5 );
Solution #3
Override woocommerce templates in your theme. There is alot of examples but this is a good starting point - https://woocommerce.com/document/template-structure/
This solution will provide the best output of your template BUT will require more maintance in future.
If you use theme that override those templates or hooks then you need to work with the theme hooks. But this is specific per theme.
First solution didnt worked but it might be related to my theme.
Second solution worked like a charm even tho i changed the hook :)
To answer my question : How to move the title on top of the product :
//First remove default title
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
//Second add title
add_action( 'woocommerce_before_single_product', 'woocommerce_template_single_title', 5 );
Good morning. I need to move the prices contained in the cards above the titles in the main shop pages and consequently the category too. I mean not the single page where you see the product itself, but the /shop page where all the products are listed. i don't really know the hook to use and priority to set. Thank you for your help.
It depends on your theme, but if everything is by default, this is the code you need:
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
Code goes in functions.php file of your active theme/child theme. Tested and works.
Good evening.
Please help me!
I have a website and moved from cards products form the number of and variations in the category. I did it using code, which is placed in the theme file functions.php:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 10);
However, when I select 2 or more number of same product and click "add to cart", the number of the selected product appears in all forms of other products.
Here is screenshot and a link to my test site:
screenshot
http://xarod.tk/shop/
I also put code:
<div class="abe"><?woocommerce_template_single_add_to_cart(); ?></div>
in the file woocommerce/templates/content-product.php, but got the same thing.
I've hunted everywhere to figure out how to move the Product Short Description from the right side of the picture on a Single Product page of Woocommerce into the tabs. I just can't find it anywhere!
Can someone please help me accomplish that.
Just remove the woocommerce_template_single_excerpt callback from the woocommerce_single_product_summary action:
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
...and add it directly to a custom tabs.php template:
woocommerce_template_single_excerpt();
Read more about overriding templates in the docs.
Wondering if anyone knows the correct function hook to move the description on brand pages created with the official Brands Plugin.
http://www.woothemes.com/products/brands/
The function below works perfectly on product archive pages, but has no effect on brand archive pages.
//Move Product Category Description to Genesis after header
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'genesis_after_header', 'woocommerce_taxonomy_archive_description', 100 );
I've searched for hours but can't find the correct actions.
Guidance would be much appreciated.
Try this
add_action( 'woocommerce_before_main_content', 'woocommerce_taxonomy_archive_description', 1, 5 );