1
I have the following problem, actually are 2 situations:
1° situation:
I need to Remove "buy" button when the product does not have registered price.
I’m making a store with Woocommerce where there are several products and registered them as variable products, but some of them have no registered price (because we still don’t have the values of these). I included a button to redirect the customer to the contact area so we can negotiate the order. However, I need to remove the purchase option from this field when the product is at zero value.
2° Situation
When the product has registered value and has no stock, it is presented this way:
I need him to appear with the same message as the 1° situation and also without the buy button.
Could someone give me a light?
Thank you!
Product link:
Woocommerce version 3.2.5 Wordpress version 4.9.1
Try that one:
<style>button.single_add_to_cart_button{display: none !important;}</style>
– Sam
That one worked, the button’s gone
– Gustavo Bassan
There was a mistake in a code I sent. Try this one.
<script>$(document).ready(function(){$("button.single_add_to_cart_button").remove();});</script>
– Sam
Nothing too expensive
– Gustavo Bassan
I downloaded a site with Woocommerce to test and it worked here. But there’s an article that hints at how to do this using the plugin’s own feature: https://www.cloudways.com/blog/how-to-remove-hide-or-disable-add-to-cart-button-in-woocommerce/
– Sam
So, I actually have two situations... I have to make sure that the button does not appear when the product is variable and has no value and also when the product has value, it is variable and has no stock. are 2 different situations
– Gustavo Bassan
Can you create a variable in PHP that detects this? Type,
$esconder_botão = true;
if the product is priceless– Sam
So I think it’s possible, but I don’t have the expertise to create this variable and make it work, rs. that’s the problem...
– Gustavo Bassan
This site is on an online server or is local?
– Sam
is online yes http://gagamilano.com.br/manuale-48mm-pdv/ see the last product of the selection, it has registered price and is selected as out of stock this is the same example I mention in the issue here of stackoverflow The idea is for it to appear in the same way as image 1, but without the buy button too..
– Gustavo Bassan