simonph79 on "[Plugin: Woo-RFQ for WooCommerce] Hide Add to Cart/Quote Button on product catergory page"

ساخت وبلاگ

simonph79
Member
Posted 14 hours ago #

Hi there,

Firstly I would like to say your plugin has answered a question I've been trying to answer for some time.

I'd like to hide the Add to Cart/Quote button on product catergory pages but not on individual product pages.

Is this possible at all?

Eaxmaple URL:
http://renshawstone.com.au/product-category/edges-and-finishes/

But would like to keep it for individual products as per the example below:
http://renshawstone.com.au/online-calculator/draining-grooves/

I am working on a calculator for a client and if I can get this sorted I will be almost there.

I have investigated CSS mods but cant seem to find the right options.

Thanks in advance for your help.

Cheers.

Simon

https://wordpress.org/plugins/woo-rfq-for-woocommerce/

simonph79
Member
Posted 14 hours ago #

Sorry running WordPress 4.5.1 and the latest version of Woo-RFQ

gplsaver
Member
Plugin Author

Posted 11 hours ago #

Simon,
Are these product categories on the page below or are they variable products?
http://renshawstone.com.au/product-category/edges-and-finishes/

simonph79
Member
Posted 11 hours ago #

gplsaver
Member
Plugin Author

Posted 11 hours ago #

What happens if you make the products variable products and on this page
http://renshawstone.com.au/online-calculator/draining-grooves/ make "length_needed" a default of 1.

Also i noticed that even when you clear the rfq cart the buttons are still showing in cart. I am not sure if this is a bug in the plugin by me. i can't reproduce here.

gplsaver
Member
Plugin Author

Posted 11 hours ago #

They are variable in a sense since they are priced by length

simonph79
Member
Posted 11 hours ago #

Yes OK that makes sense.

I am not seeing where I enter the length needed as a default of 1 however.

My biggest challenge is that I am seeing add to quote and select options buttons. hence i want to hide the add to quote button on the product category pages but not on individual items.

gplsaver
Member
Plugin Author

Posted 11 hours ago #

I think if you make the products variable you will not the see add to quote button. see if we can solve that problem first and we will see about the default of 1.

simonph79
Member
Posted 11 hours ago #

I have now seen the in quote issue once I remove items, but it does allow me to re-add and does not duplicate.

gplsaver
Member
Plugin Author

Posted 11 hours ago #

I think you need the "select options" button since that is the only way they can get to the product to enter the variable length.

gplsaver
Member
Plugin Author

Posted 11 hours ago #

if you just don't want to see any buttons on the archive page then do the following i will give you on the next post. stay tuned

simonph79
Member
Posted 11 hours ago #

Great thanks.

We do need to keep the Select Options button for sure. But we can also click the product image which takes us to the options anyway.

But if we can leave Select Option and hide add to quote that would be great.

gplsaver
Member
Plugin Author

Posted 10 hours ago #

This is what I got for you based on two pages you gave me. Hope it works

add_filter('gpls_woo_rfq_in_rfq_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
add_filter('gpls_woo_rfq_request_quote_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
function gpls_woo_rfq_request_quote_text_mod($request_quote)
{ $url = $_SERVER["REQUEST_URI"]; $Hide = strpos($url, 'shop'); if ($Hide!==false) { $request_quote=""; } $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; echo $css; retu $request_quote;
}
function gpls_woo_rfq_Hide_Add_To_Quote() { $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; echo $css;
}

gplsaver
Member
Plugin Author

Posted 10 hours ago #

sorry change 'shop' above to 'product-category' or 'edges-and-finishes'
depending on what you are doing. probably 'edges-and-finishes'

gplsaver
Member
Plugin Author

Posted 10 hours ago #

hope this works

gplsaver
Member
Plugin Author

Posted 10 hours ago #

here again with corrections

add_filter('gpls_woo_rfq_in_rfq_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
add_filter('gpls_woo_rfq_request_quote_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
function gpls_woo_rfq_request_quote_text_mod($request_quote)
{ $url = $_SERVER["REQUEST_URI"]; $Hide = strpos($url, 'edges-and-finishes'); if ($Hide!==false) { $request_quote=""; } $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; add_action( 'wp_print_styles', 'gpls_woo_rfq_Hide_Add_To_Quote' ); echo $css; retu $request_quote;
}
function gpls_woo_rfq_Hide_Add_To_Quote() { $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; echo $css;
}

gplsaver
Member
Plugin Author

Posted 7 hours ago #

let me know if it works :)

Hi there,

Sorry for the delayed response.

I have added the code you kindly provided above and when i do some of the text tus red and is removed when I click save stylesheet in the CSS editor.

Link to a screen shot below.

http://renshawstone.com.au/wp-content/uploads/2016/04/CSS-Snippet.png

Can I confirm the code your provided was meant to be applied in the CSS editor? Silly question I know.

But because the red text in the code is removed the change has not worked as yet.

Cheers.

Simon

gplsaver
Member
Plugin Author

Posted 1 hour ago #

sorry. I should have been more clear

Add this code to the bottom of your functions.php in your theme directory

add_filter('gpls_woo_rfq_in_rfq_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
add_filter('gpls_woo_rfq_request_quote_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
function gpls_woo_rfq_request_quote_text_mod($request_quote)
{ $url = $_SERVER["REQUEST_URI"]; $Hide = strpos($url, 'product-category'); if ($Hide!==false) { $request_quote=""; } $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; add_action( 'wp_print_styles', 'gpls_woo_rfq_Hide_Add_To_Quote' ); echo $css; retu $request_quote;
}
function gpls_woo_rfq_Hide_Add_To_Quote() { $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; echo $css;
}

that's OK and thanks for such a quick reply.

I've added the code into the functions.php file as per the above but can still see the "Add to Quote" button at category level on all categories.

Any thoughts?

Cheers.

Simon

gplsaver
Member
Plugin Author

Posted 56 minutes ago #

let me check. it should have worked

gplsaver
Member
Plugin Author

Posted 52 minutes ago #

All of this goes to the end of functions.php and uploaded to the server

add_filter('gpls_woo_rfq_in_rfq_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
add_filter('gpls_woo_rfq_request_quote_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
function gpls_woo_rfq_request_quote_text_mod($request_quote)
{ $url = $_SERVER["REQUEST_URI"]; $Hide = strpos($url, 'product-category'); if ($Hide!==false) { $request_quote=""; } $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;}.add_to_cart_button {display: block !important;} </style>'; add_action( 'wp_print_styles', 'gpls_woo_rfq_Hide_Add_To_Quote' ); echo $css; retu $request_quote;
}
function gpls_woo_rfq_Hide_Add_To_Quote() { $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none !important;}</style>'; echo $css;
}

gplsaver
Member
Plugin Author

Posted 51 minutes ago #

sorry use this one instead

add_filter('gpls_woo_rfq_in_rfq_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
add_filter('gpls_woo_rfq_request_quote_text', 'gpls_woo_rfq_request_quote_text_mod',1000,1);
function gpls_woo_rfq_request_quote_text_mod($request_quote)
{ $url = $_SERVER["REQUEST_URI"]; $Hide = strpos($url, 'product-category'); if ($Hide!==false) { $request_quote=""; } $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none;} </style>'; add_action( 'wp_print_styles', 'gpls_woo_rfq_Hide_Add_To_Quote' ); echo $css; retu $request_quote;
}
function gpls_woo_rfq_Hide_Add_To_Quote() { $css='<style type="text/css">.woocommerce ul.products li.product .button { display: none !important;}</style>'; echo $css;
}

simonph79
Member
Posted 45 minutes ago #

Thank you.

I copied an pasted the entirety of the text above and added it to the bottom of the fucntions.php file for the theme as advised.

http://renshawstone.com.au/wp-content/uploads/2016/04/CSS-Snippet-1.png

Still not working as yet and it has defintely been appended to the functions.php code and saved.

gplsaver
Member
Plugin Author

Posted 32 minutes ago #

Simon
I think i know what the problem is. you have super cache plugin tued on. tu off the plugin while in development so you can see the changes

simonph79
Member
Posted 26 minutes ago #

Ok will give that a shot now.

simonph79
Member
Posted 14 minutes ago #

Tued super cache off but no success I am afraid.

Still seeing add to quote buttons on category pages.

gplsaver
Member
Plugin Author

Posted 5 minutes ago #

Did you click "Clear All caches"?

gplsaver
Member
Plugin Author

Posted 4 minutes ago #

On the WP Super Cache Settings page, click Delete Cache

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 118 تاريخ : جمعه 10 ارديبهشت 1395 ساعت: 8:17