Problems Customising WooCommerce Checkout Page - wordpress

I'm having major problems customising the checkout page on a WooCommerce site for a client.
They have asked me to move a heap of fields around and, for the most part, I've got it done but the login form is causing me no end of grief.
They have asked that I create something similar to the checkout at www.adairs.com.au and would like the login form to be part of the "Billing Fields" section, and only displayed when a customer clicks the "Existing Member" tab.
I've got everything moved around but when clicking on the "Existing Member" tab to display the login form, and then logging in I get errors saying "Billing First Name", "Billing Last Name" and "Billing Address" are required.
Digging into it, it seems that when I call do_action( 'woocommerce_before_checkout_form', $checkout ) it is creating all the necessary form fields but it is not wrapping it in a form, so there is no data being posted.
I've tried moving the hook around to different parts of both the form-checkout.php and the form-billing.php files but get the same result.
When I call the same hook in the payment.php file, or leave it as it was originally coded the form is created as it should be, but is not rendered to the section of the checkout I am hoping for.
I can't for the life of me figure out why the form is created some times when I call the hook and not others.
I hope this makes sense. Any help would be greatly appreciated.
Thanks in advance,
Don

Sounds like all the "moving around" is breaking the logic. I would look into WooCommerce plugins that allow you to customize the checkout. There are lots of them
Another possibility... if you want the login form "only displayed when a customer clicks the Existing Member tab" why not leave the form where it is -- code wise -- and use JS/JQ to show/hide the actual form inputs. Look at this woo demo theme and click "Returning customer? Click here to login" for one idea.

Related

How can I modify the "Paid" booking status label in WooCommerce Bookings

Using WooCommerce Bookings - I am trying to modify the booking status label which appears on customer-facing front-end views and in customer emails. When a reservation is booked, in the booking summary it displays a status label of "Paid", but since I am using this to book free reservations I don't want it to say "Paid" anywhere because that will confuse customers. I'm trying to get it to say "Booked" instead. Literally all I care about is the text that appears, I'm not trying to modify any status in the actual booking or order.
I would hide the element with CSS, but that same html element is used to display a "Cancelled" label if the customer cancel the booking, and I don't want that hidden. Also hiding it in CSS would not prevent "Paid" from appearing in the customer booking confirmation emails.
In /order/booking-display.php I located this code where the status is being displayed:
echo esc_html( wc_bookings_get_status_label( $booking->get_status() ) );
I assume this is relevant, but I'm a designer & marketer, not a developer, so this is over my head. I have been searching everywhere for a way to do this, but can't figure this out. Thanks in advance for your help!
WooCommerce normally doesn't allow you to change the core order statuses which are Paid, Cancelled, On Hold. However, if you are looking for a paid solution, there's an extension provided by WooCommerce which allows you to do so. You may wanna check this out:
https://woocommerce.com/products/woocommerce-order-status-manager/
Hope this helps you.
Right after I posted this question I realized... why don't I just use conditional statements to check the booking status and display different markup depending on the status? So I did that and it worked like a charm. I'll update this answer with the code in the morning.

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?

Remove "further information" fields from Wordpress profiles

I have been trying for a while to remove the "further information" section from the user profile field in wp. Every-time i go in to edit a users information it validates these input and marks them as required.
I have tried this approach to see if its something within this array:
add_filter( 'user_contactmethods', 'update_contact_methods',10,1);
function update_contact_methods( $contactmethods ) {
print_r($contactmethods);
return $contactmethods;
}
This returns an empty array.
I have also found a few references to jQuery. But removing the element manually from the page through chrome dev tools still triggers the validation.
Any-thoughts on this would be appreciated.
So it turns out it was events manager pro, under Admin -> Events -> Forms Editor -> User Fields.
A bit annoying but works fine once you find it.

WooCommerce - no confirmation after adding product to cart

I'm not sure it's meant to be like this, but when I click the 'Add to cart' button on a product (when viewing a page of products), no visual confirmation is given to the user.
Am I missing a JS file? Or maybe I need a div with a specific ID in my HTML for the message to be displayed in? Or do I need to create my own JS callback method to handle when the product has been added?
I've researched this, and there's surprisingly little info on it (so maybe I broke something?).
I have WC's "Enable AJAX add to cart buttons on product archives" option ticked, and I can confirm that products are actually being added to the cart - the user just doesn't know anything about it!
Thanks in advance.
Problem solved - I had unticked WC's "Enable WooCommerce CSS styles". It should come with a warning in my opinion! :)

Resources