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.
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.
I'm using the shortcode
[product_category category="jacuzzis" columns="3"]
to show some amazon affiliate products on my website. The issue is that I don't want the user going to the product page under my domain but instead going to the amazon affiliate link.
In order to do that I'm trying first eliminating the link on the products. I'm using this code
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 10 );
It should remove the open link tag and the close link tag, but the link is still working after adding the snippet.
Does anyone know why?
You could use woocommerce_after_add_to_cart_quantity hook to add your custom button with ACF field. and just remove 'buy' button with CSS or another hook.
I'm building an affiliate site and obviously for every product I use page not post. But pages don't have categories or tags and even if we add them to pages, our pages won't appear on categories' pages and in widget areas of front page.
Woocommerce functionality is perfect but it looks a little bit weird to use it for an affiliate site, not a store. Is it okay to delete e-commerce features (price, add to card and stuff like that) and use the rest of Woocommerce?
It is nothing weird to use Woocommerce without cart stuff.
Sometimes clients want a catalog of goods, but not always need the cart and delivery staff on a site.
In this plugin it is much more comfortable to organize categories and editing of many products. Plus you get interaction with other plugins that build for Woocommerce.
If you make it thru "Custom Post Type", then it is normal if there are about 10.
If they are more, than you will need to create many solutions by yourself and you will have problems with their further maintenance.
Woocommerce is pretty good for e-commerce sites. As you creating affiliate site for that you can hide some functionality of Woocommerce. As you mention you want to hide (price, add to card and stuff like that). You have to use some actions to remove those functionality. Copy following code and place it in your active theme's function.php file.
Note: If you have child theme then you must have to add this code in child theme's function.php file.
add_action('after_setup_theme','activate_filter') ;
function activate_filter(){
add_filter('woocommerce_get_price_html', 'hide_price_cartBtn');
}
function hide_price_cartBtn(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
}
comment if you like to remove more things as you mention stuff like that
I have very beginner level understanding of wordpress, woocommerce and elementor. I am still learning a lot of things. I believe that the best way to learn is to imitate. So, I go through various themes and try to imitate their behaviour and appearance using Elementor. But, this particular theme caught my eye. The Add to cart button appears when someone hovers over the product image instead of always being there. Can you guys please help me figure this out or atleast point me in the right direction?
This is how it should look when someone hovers over the images
This is how it looks when the mouse pointer is away
More info
<?php if($available) {?>
Buy now
<?php } ?>
This code solves my problem as expected.
WooCommerce documentation reference
Solution: Add code in your theme's function.php file.
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page() {
global $product;
echo 'Add to cart';
}
Solution: Install Custom WooCommerce Add to Cart plugin
Custom WooCommerce Add to Cart Plugin
Solution: You can use hooks with shortcodes:
custom add to cart button
Or create overrides for WooCommerce files in your own template