I want the Add to Cart function in WooCommerce to be completely hidden for specific production variations. I have a product offer (request a quote) plugin which in some cases I want to be used.
For example, a t-shirt in xl and green should be possible to be bought, but if there needs to be a print on it (I got variations for a print in 1, 2 or 3 colors), I want people to use the "request an offer button". So to hide the add to cart button would be great.
I saw the next post, however this one still shows the add to cart button (and doesn't seem to work for me)
Hide Add to Cart button in Woocommerce product variations for a specific attribute value
Related
Help me I'm looking around, but I still don't find what I need, add another button on my woocomerce store page with the option to add to cart and continue shopping without leaving the page
Here's an example of what I need:
We have a plugin that allows people to submit offers on products, and then the site owner can accept, counter, or decline offers, and you can negotiate back and forth until a price agreement is reached.
We are using the woocommerce_after_add_to_cart_button hook to add the offer button after the cart button.
We are getting lots of feedback that people want to leave the price of the product empty so that it simply display a price on the site, it won't display the Add to Cart button, but they do want it to display the offer button and allow that functionality.
If you set the price to 0.00, then it says FREE on the site, and still includes the add to cart button, so that's no good.
When left blank, though, the problem we run into is that when a customer clicks to buy a product from an accepted offer, WooCommerce keeps removing the item out of the cart because it says it's not purchase. This is happening because of the is_purchasable() function. With a blank price WC says the product is not purchasable, so it will automatically remove itself out of the cart, which it is indeed doing.
There is a hook available that allows us to force $purchasable = true for the product, but then of course that makes the Add to Cart button show up again, which doesn't make sense for this use-case.
So as it stands now we're at that point. We've got the system overriding $purchasable so that we can complete the checkout on a product with an empty price, but it's leaving the Add to Cart button, which allows the person to add the product at 0.00.
I'm stumped on the best way to hide to the Add to Cart button in this scenario..?? I would usually hide it by using that hook to make $purchasable = false, which takes care of it nicely, but in this case I can't do that because that's what keeps us from being able to purchase the product, of course.
Any information on a way around this would be greatly appreciated!
UPDATE
I found this tutorial for overriding core template files from a plugin: https://www.skyverge.com/blog/override-woocommerce-template-file-within-a-plugin/
So I think what we're going to try is to basically say "if $purchasable = false and $offers_enabled = true, then use these templates for the add to cart button."
Within our template we're doing nothing but commenting out the actual <button> element. This leaves all hooks in place, but hides our button.
Decent solution? Horrible idea?
I have created variations (height and width) for my products using advanced custom field plugin. All variations are doing fine.
The problem is, after selecting variations when I click on the add to cart button, product is added to my cart.And When I click on the cart icon on the menu bar, it shows me the correct price of that product. But in cart page the price is displayed as 0.
If I select simple product, It is working fine.
How can I solve this problem???
I'm trying to make this work but i cannot solve it. In the single product page i have placed the product details in a tab, but the quantity box is no longer working. I also tried it with a text field, but it constantly adds just one product. Can anybody help me with this?
It seems that the submit button is not taking the amount into account...
Add to cart
Where data-quantity is not updating...
hey all in woo commerce plugin i add product that is variable product that is watch in different color that is good, but on from end when i show that product drop down of variation product is come but when i choose any attribute from it then related product not display only featured image display as i set when add product.
Any solution??
is there any setting from coding or functions.php file for displaying variation product and also add cart button not display on that product.
if you have any solution then please answer me.
Thank You
On the Variations tab, if you click one of the variations you have added, it will drop down more details. Then you can click the square under SKU to add a photo.