pls help me to write code for woo-commerce wordpress.
problem =
i want to add double click function to Buy button .
-on first click its add product to cart as normal
-on second click its remove the product from cart
thankyou
I want it to be direct copy - paste to use in wordpress
Related
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?
I can't figure out how to change the button in the category page.
I am trying to redirect to the checkout page, when that customer press the add to cart button.
With this code in the function.php I got this working for the single product page.
add_filter('woocommerce_add_to_cart_redirect', 'themeprefix_add_to_cart_redirect');
function themeprefix_add_to_cart_redirect() {
global $woocommerce;
$checkout_url = wc_get_checkout_url();
return $checkout_url;
}
But this doesn't affect the category page. If the customer press the button here, nothing changes...
Hope someone has a solution for that.
you need to disable AJAX add to cart buttons on archives
go to WooCommerce->Setting->Product and then uncheck the Enable AJAX add to cart buttons on archives
and then your code will work on the archive pages.
After using shortcode [add_to_cart id="09"] for ex. "Read More" button is displayed, instead of "Add to Cart".
What shall I do to make it "Add to Cart" so that my product gets added to cart. I remember my client wasn't interested in having add to cart button.
To solve his problem I included "Read More" button and directed the flow to single product page. Now I want to include "Add to Cart" button to add products to cart, however it is showing "Read More", instead of "Add to Cart".
Please help me solve the problem
In this case, you could use the shortcode [add_to_cart].
But you can also create your own button by using a custom Add to Cart URL.
To create a custom Add to Cart URL for that product, you will need to add ?add-to-cart=123 replacing 123 with the ID of your product.
The result will be something like https://www.yourwebsite.com/?add-to-cart=123. Whoever clicks on this link, will add the product 123 to their cart.
To begin, open your dashboard and go to Products.
In the products’ list, hover over the product you want to create a custom Add to Cart URL for. On the left, you will notice a text like ID: 123 where 123 is the ID of that product.
I have OpenCart v2.3 and I need make customize on product details page.
Explain what I need:
The product take price from the admin panel by default.
I need add custom price when user click add to cart button.
Explain how OpenCart adds product to cart:
When user click on add to cart button, ajaxFunction is called and goes to checkout/cart/add function with all input fields.
Inside function add() in cart controller
$this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);
And system/library/cart/cart.php contains all functions
How can apply this idea?
"How can apply this idea?"
With difficulty, because it will affect a lot of parts of the system.
Perhaps you should consider having a second copy of the product with a different price and your code adjusts just the template so that clicking "Add to Cart" actually adds the second product instead.
I am using avada 4.0.2 theme.
When I add price of a product, Add to cart button is displayed everywhere where the product is shown but when there is no price added,
then there is no Add to cart button. I want to display "Add to cart" button always even if I don't mention any price in Regular Price column.
Actually I want to display a pop up form on clicking a button. I want to display this button on the place of Add to cart. for this I am using a WooCommerce Email Inquiry & Cart Options LITE plugin which replaces the Add to cart button with Buy Now button which on being clicked displays pop up form.
Now the problem is this button is displayed only when price is added to a product.
I somehow managed to display like I wanted. I could not make Add to cart show always rather I wrote .product-buttons{diaplay:none;} and echo the code of the button in content-product.php used in the plugin.