woocommerce custom add to cart button - php

I am working on a project where customers can buy a product or send it as a gift. In the product page I need two buttons, one for buy and the other one for gift. Clicking one of the two buttons, it will add the product to the cart, then in the cart I have to distinguish which one is a buy product and which one is a gift product.
The problem is that I am not able to catch which one of the two buttons is clicked and how to keep this value (and where) and show it in the cart.
Any idea?
thanks

Related

WooCommerce Meta-key for products in cart

First post here so I'll try to make it as good as possible.
For a WooCommerce / WordPress project, I'm trying to achieve the following. When the cart is empty, there should be a button displayed with the text "Return to store".
Now the button isn't the problem, I've added this with Elementor, now usually I use the JetEngine Dynamic Visibility option to show/hide things.
I've also done this with stock status. There I used the _stock option to only display when there are 5 or more in stock left.
So I'm trying something similar with the cart, whenever there are 1 or more items in the cart, this button needs to be hidden because whenever someone has 1 item in their cart we want them to proceed to the checkout and not return to the shop, because the average product bought per order is 1 for this particular shop.
But the one thing I can figure out is, what key do I need to use to check items in the cart?
I've been trying several options I found online but none seem to work.
Does anyone know how to do this?
Thanks!

How to add the buy now button to a product with hidden add to cart button?

I have items that are using Woocommerce Product Add-ons. This plugin uses the POST method, however I wanted to keep the Ajax buttons for the other products.
Based on "Remove add to cart button for specific product categories in WooCommerce 3" answer code That removes the add-to-cart button for specific product tags on single product pages, but problem now is I have no button to show.
The code replace also the ajax add to cart button by a button linked to the product and on single product pages, when hitting RETURN/ENTER key, the product is added to cart, which is exactly what I wanted. However, I want to have a Buy Now or Submit button in place. What should I do?

Change product price when option selected in Prestashop

I'm developing a module that appears in the product page. This module consist of a checkbox which when is checked, shows a few inputs to be filled by the client and add an extra amount of, for example, 50.
How can I add this amount to the product cart? I'm using the hook hookActionCartSave to retrieve the cart but I can't update it adding the amount of 50.
The ideal is to reflex this concept like shipping costs but I'm stuck on how to change the product price or add a new concept when the checkbox is checked and client click "Add to cart" button.
Thank you!

How to show all products category wise in shopping cart summary page in prestashop

I am new to prestashop
I want to show all the products in prestashop in my cart summary page.
Even though the customer doesn't ordered a product, it should be displayed in his/her shopping cart summary page with quantity as 0. So that from there he must be able to add quantity if he needs.
The product must be displayed category wise.
NB: I have searched and couldn't find a solution :-(
I think, you should not use cart, but should use template for product category instead of cart. This template make you able to show cart quantity. Cart will "invisible" in your shop. The user will select quantity of goods, all of them will add to the cart on 'onchange' event. When, the user press "Order" button and go to the real cart where he see the summary order information and confirm his order. Shop without traditional cart will inconvenient, because selected goods will in the different categories of the shop
The result will like this: http://screencast.com/t/8csYCudqD
Use ajax command which using on 'Add to cart' button click on 'onChange' event for input with good's count (simple jquery ajax)

about php , interactive and dynamic application like ecommerce applications

I am working on a interactive and dynamic php application which has two numbers of products
I want to make the following.
There is a list of products, each product has two buttons buy now and add to cart. Also a quantity field for each product, when I click on buy now button of one of the product it redirects me to the cart page where it shows the product name, price, quantity, subtotal and total.
On this page I have one button that is "continue-shopping" if I click on it then it redirects me to previous page, if I click on second product of list then it again redirects me to the cart page where it shows only second product description not one that have been added before
Its better to make use of DRUPAL for your development.

Categories