woocommerce - coupon on checkout page - php

I'm using Woocommerce for Wordpress to build a webshop.
I have removed the coupon from cart and added it to the checkout. When I enter the coupon code and hit 'apply coupon', it completes the whole form and goes directly to the payment gateways. I want to make sure the coupon first gets added to the order total. Any idea?
Thanks!

Woocommerce already provides provision to add coupon from the checkout page you don't need add. Probably you have edited the checkout page template and added the coupon form inside the checkout form that's why checkout form is submited on clicking apply coupon. In order to customize the coupon in checkout page you have to look into wooocmmerce checkout.js.

Related

WooCommerce 5.6.0 Checkout Coupon Form Issue using functions.php

My original coupon box was set by default to the top.
I'm using How do I move the apply coupon input below the order on the checkout page in Woocommerce? answer code and moved the box below products in the "my order" section.
Each time I submit a coupon, it removes some of the entered data as the page is being submitted.
Is there a method to remove this submit page feature & have it behave like the default option where it updates without refreshing the page?
Thanks in advance!

add apply coupon link to woocommerce customer payment page

I have developed a system to create orders programmatically in woocommerce. However when a customer clicks on the link to go to their payment page it does not show the 'Have a Coupon' input box. I haven't adjusted any of the templates.
Any ideas on how I can get the coupon input box to appear on the customer payment page?
Location I am talking about is:
<mywebsite>/checkout/order-pay/<order_id>/?pay_for_order=true&key=<order_key>
Thank you for any help with this, I am struggling with it
Payment page is an endpoint, so must apply coupon before it reaches this point

Change Woocmmerce Default Payment gateway Based on Add To Cart Button

On my woocommerce single product pages I have added a duplicate “Add to cart” button,Now Two Add to cart button in single product page.if it was possible when someone clicks the first add to cart button and gets redirected to the checkout page that we could have the payment option of “First Payment Gateway” open as the default?Same as i want someone clicks the second add to cart button and gets redirected to the checkout page that we could have the payment option of “Second Payment Gateway” open as the default
You can override checkout.js and achieve this.
Have a look here: How To Prevent Woocommerce from selecting default payment method on Checkout page?

I'm looking to add a page of order meta before woocommerce cart page

I have set up a function on my billing/shipping page for woocommerce where the user selects a few items based on a custom loop.
I was wondering if it is possible to add a page before the cart page so process will be as follows:
Choose items from custom loop
press 'proceed to cart'(already hooked up to add the specific product)
press 'proceed to checkout'
On successful payment the information they chose on step 1 will show in their order on the backend and in the email.
I already have step 4 working but step 1 is actually on the checkout page. I need to move it to a page before the cart.
Is there a hook that I can use? Currently I am using
add_action( 'woocommerce_checkout_after_customer_details', 'my_custom_checkout_field' );
Thanks

Coupon Code on Checkout Woocommerce

I am currently trying to have coupon codes work on my checkout page, using the Oxygen theme. Currently I am loading both the cart and the checkout on the same page, but when using the coupon code provided by the cart, I get redirected to the cart page, which I absolutely do not want (want to stay on xxxx.com/checkout.
How can I go about removing this href, or including the coupon code solely on the checkout page without using the coupon window provided by the [woocommerce_cart]
What you are asking is not traditional behavior of checkout, but it can be done. All you have to do is change the Cart Page's target Page.
Goto to Woocommerce settings
Flip to the Checkout tab
Under Checkout Pages, locate Cart Page
Change its target page to Checkout or whatever page you are using for that purpose
Save and Test

Categories