Hello @richardmaximun,
What you need is a little custom theme work. 🙂
This will take a little extra code in your functions.php theme file.
You might start by trying code like this:
http://wordpress.stackexchange.com/a/44707
You might also need this.
http://wordpress.stackexchange.com/a/136098
You will need to replace 272 with the category ID of your “gift” category (you can find that by looking at your product categories listing. Let me know if you still need help.
Perhaps you might not want to hide any of it. Just use a function to remove the add to cart button for only your gift wrapping category, and then add a link back to cart in the product short description as well as the category description. That way, customers can view each wrapping product in detail, extra pics and details is always nice, but not be able to add it unless in cart.
My theme lets me choose which categories to display links, or buttons for. So the gift wrapping category can be removed pretty easy.
Here is an example of the code I found (wish I remembered who posted it so I could give proper credit): I named the function joei_buttons , but you can rename it if you like to some other unique name. My gift wrapping category is “Gift Wrapping” with a slug of “gift-wrapping”. If you have name your category slug anything else, you will need to change it in the has_term area below as well.
Just add it to the bottom of your Theme Functions (functions.php)
function joei_buttons(){
$product = get_product();
if ( has_term( 'gift-wrapping', 'product_cat') ){
// removing the purchase buttons
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
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 );
remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
}
}
add_action( 'wp', 'joei_buttons' );
-
This reply was modified 9 years, 5 months ago by
joeistoybox.
-
This reply was modified 9 years, 5 months ago by
joeistoybox.