-
Author
-
October 7, 2016 at 08:14 #138529izaParticipant
Hello seventhqueen,
Can you pls assist me what i am missing.
I want to remove add to cart button on quick view in specific category and this code still doesnt work.
function remove_add_to_cart(){
$product = get_product();
if( has_term( ‘my-category’, ‘product_cat’ ) ){
remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 ); } }
add_action(‘wp’,’remove_add_to_cart’);
If i use @sharmstr code
add_action( ‘init’, ‘remove_product_meta’ );
function remove_product_meta() {
remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
}
Its work but it removes globally.
Thanks in advance
October 7, 2016 at 14:15 #138564LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
October 7, 2016 at 18:40 #138623RaduModeratorHi,
Try to use this code
COPY CODEadd_action( ‘init’, ‘remove_product_meta’ ); function remove_product_meta() { if ( has_term( 'audio', 'product_cat' ) ) { remove_action('woocommerce_single_product_modal_summary', 'woocommerce_template_single_add_to_cart', 30 ); } }
Instead of audio there should be category name.
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 12, 2016 at 18:17 #139293RaduModeratorTry with this instead
add_action( ‘init’, ‘remove_product_meta’ );
function remove_product_meta() {
if ( is_product_category(‘my-category’) ) {remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
}
}Replace my-category with your slug
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 25, 2016 at 00:38 #141022izaParticipantHi radu,
Sorry for a late reply,
The code still doesnt work. Any other ideas why?
Thanks in advanced!
October 25, 2016 at 18:31 #141189RaduModeratorDo you have replaced my-category with your category slug ? from the snippet ?
For those kinds of questions please write us to themesupport@seventhqueen.com
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.