How to hide tags and categories from a single product page woocommerce ? Wordpress - wordpress

I have been trying to hide the tags and categories from (display only) on my single product page, the developer of my theme sent me the following code, to be added in the customize css section but it is not working.
.wcs-meta__cat, .wcs-meta__tags {
display:none !important
}
I have also read that these tags help you in SEO of your website, what if i just want to hide them in the frontend but they stay in the backend, is it easily possible?
This is the link of the product page:https://www.hodst.com/wp/product/p-a-n-i-s-y-n-t-h-w-a-v-e/#

/**
* Hide SKU, Cats, Tags # Single Product Page - WooCommerce
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
Need place above code in theme's function.php file accordingly.

Related

remove links from woocommerce category using a shortcode

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.

Add HTML elements after Social Share Buttons

I want to add a working shortcode after Single Product Social share buttons. I Have a page builder plugin which add custom made content with a shortcode anywhere in wordpress post/page.How can I add that shortcode after social share buttons in single product page in woocommerce. like this
You can try to use following hooked function:
add_action( 'woocommerce_share', 'after_woocommerce_share', 100 );
function after_woocommerce_share(){
// Your code
}
Code goes in function.php file of your active child theme (or active theme).

Woocommerce - Move titles over thumbnails of products in Category page

I need to move the titles of the products, while I am browsing the category page, over their thumbnails
Details:
I have created a shop page where I only display the categories.
Every category contains 1 to 10 products.
Once I click a category, I land on a page where I see all of the products in that category.
I would like to see the titles of those products appearing over their thumbnails.
Thank you
A few more details relating to your parituclar setup are needed to give a proper answer. However, I'm going to assume you have everything at default. This is what you would need to add to the end of functions.php in your active theme folder:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
For reference, check https://github.com/woothemes/woocommerce/blob/master/templates/content-product.php and https://github.com/woothemes/woocommerce/blob/master/includes/wc-template-hooks.php
If this does not work, check:
that you use the latest version of woocommerce. Actually a few versions back should work the same, but not too far back.
that your woocommerce templates are not overwritten. Check your theme folder for a file called content-product.php or in a subfolder woocommerce/content-product.php. If that has been altered, you need to adjust accordingly, perhaps by making changes right there.
that your theme does not already mess around with product display hooks. If it does, find out what's different.
Please note that this changes behavior for all woocommerce loops, such as any shortcodes you might be using and the "related products" section in single product view, if that is enabled. To affect only categories, the changes should be wrapped in a condition check ( is_product_category() ).
If you put code into a plugin, you must wait for WooCommerce loading:
add_action('plugins_loaded', function()
{
// move product's title before product thumbnail instead of next to that
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
add_action('woocommerce_before_single_product_summary', 'woocommerce_template_single_title');
}
Added this CSS for the product title and it worked fine for me. I used media query of course.
position: absolute;
top: 0px;

How to remove shopping cart from WooCommerce plugin in Wordpress?

I'm using the Virtue Theme in Wordpress and have installed the WooCommerce plugin for setting up my online store. I want to remove the shopping cart function completely and instead place an order form on individual product page.
Help is sought to remove the shopping cart.
this is my experienced with Woocommerce about remove carts function. I added this code in functions.php in my Virtue themes.
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
In this Web I used that code. I Hope that's can solve your probelms. Thank you :)
Using firefox right click on the cart and open inspector. Find the css used on the right panel. Then, in modify theme, add custom css like:
.woocommerce-active .site-header .site-header-cart {
display: none !important;
}
(In the above code «.woocommerce-active .site-header .site-header-cart» was in the right panel of "inspector". While in modify mode you can instantly see the result, so make some tries if CSS name is not the correct one.)
What worked for me was finding the class associated with cart using the inspect tool in Chrome (any browser should provide the same feature). Customize the theme appearance and add custom CSS.
.cart-button {
display: none !important;
}
Watch the video showing the steps (there's no audio) at https://www.loom.com/share/9f9d1a8d3fb346e0b954c8c26f06a926
To remove shopping cart from WooCommerce plugin in Wordpress, select the Disable option in Menu cart:Display
Go to Appearance>Customize>WooCommerce>General>Menu cart

Products disappearing when adding any category on WooCommerce

Has anyone experienced this before? This is my first time working with WooCommerce.
If I don't add products to a category they will show up in the main shop page as well as have a single product page, as soon as I add a category they will not show up on the main shop page, the category page, or the single product page.
I have not manipulated the wp_query in any way on the page.
I am integrating it into my custom theme which is really barebones, the only thing I have changed is the following in my functions.php file:
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'urbantac_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'urbantac_wrapper_end', 10);
function urbantac_wrapper_start() { echo '<div id="products-content" class="products wrap clearfix aligncenter content-container">'; }
function urbantac_wrapper_end() { echo '</div>'; }
I was using another WooCommerce plugin:
http://www.woothemes.com/products/catalog-visibility-options/ to turn off the "store" functionality of WooCommerce and use it as a "catalog"
This adds two settings on the product category pages, and sets defaults to NOT show anyone the content (no idea why this is). The settings are Role Visibility Rules and Location Visibility Rules. It does not mention this anywhere in the documentation for the plugin!
So if you are using this plugin you can no longer create categories directly from a product page, you must first create the category, set the visibility rules, and then create the product.

Resources