Creating extra Buy now button on woocommerce product - wordpress

I want to create a new buy now sort of button besides the real buy now button on a woocommerce product. The function for this will be to be able to trade a product with another product, so when clicking this new buy now, it will open a custom popup, with image fields and the ability to add extra cash on top of the product - the seller will then be able to accept or deny the offer - how do i go about it? We use Woocommerce, Buddypress, And WooCommerce vendors - how can we do this?
After accepting it will go to checkout for buyer.
Thanks.

This code will create extra button on single product page beside add to cart button.
add_action('woocommerce_after_add_to_cart_button','additional_button');
function additional_button(){
echo '<input type="button" name="trade_product" value="Trade Product />"';
}

Related

How can i replace Add to cart with vendors phone number dokan plugin in wordpress

I want to get rid of Add to cart button entirely and replace it with the “contact seller” buttons that shows the seller info directly to the buyer. instead of this?

Add continue shopping button at woocommerce store category

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:

How to get Customer mobile number when click add cart button when order in Woocommerce?

Woocommerce Wordpress :
Is there any way to ask customer to provide his phone number before placing an order?
what I need to do is that once a customer adds a product to cart (Before placing the order), customer should be asked to provide his details, plus that I need to notify the admin about the customer and products details

Customizing Woocoomerce Cart page

Hi I want to add checkbox on my Cart page of woocommerce when user check the box it will automatically subscribe them for my product. I have bought woocommerce subcriber plugin but I don't know how to add checkbox which will have this functionality in cart page.
I will try to answer to the best of my knowledge given that I am not proficient with woocommerce. But the general idea is that, you add your checkbox on the cart page of the theme and pass the the value via form data(like name="subscribe" value="True/false") to the data handler(most probably the next page in the checkout cycle which would be delivery or payment options page), which will then call the plugin and pass the subscriber info to it. I would say that it would make sense to put the checkbox where you collect customer info but hey your site, your choice.
Sorry if this is a very generic answer and not a detailed one. I am very new to this myself. Best of luck.

Unique issue with WooCommerce and hiding the add to cart button..?

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?

Resources