remove links from woocommerce category using a shortcode - wordpress

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.

Related

How to hide tags and categories from a single product page woocommerce ? 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.

Wordpress: Woocommerce without e-commerce for affiliate site

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

Moving woocommerce shortdescription

im new at wordpress, and im trying to move the blocks from the product page details of woocommerce. In my situation im trying to move the short_description block after the add button, but isnt working.
Here my code:
add_action( 'woocommerce_after_add_to_cart_button', 'woocommerce_short_description');
woocommerce_short_description is a filter, not a function that loads the short description template. The function that you want is woocommerce_template_single_excerpt
add_action( 'woocommerce_after_add_to_cart_button', 'woocommerce_template_single_excerpt' );

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

Resources