WooCommerce: Modify "Order Received" Page

I’m finding that modifying WooCommerce’s templates can be rather time consuming, but I would appreciate some insight on how I can fix the problem with the way the dynamic data posts in the ‘order-received’ page, if a user does not post data in a textbox.

Looking at the below:

(you can go here to add an item to the wish list and go through the checkout process)

You can see the WooCommerce’s dynamic data posts it really oddly. I have tried using jQuery to append the ‘Billing City…’ to the Billing Address and doing the same with the ‘Shipping City…’ with the Shipping Address and then hiding the other labels. This does work successfully, but not for all orders BECAUSE during the checkout, if you post an Order Number (do not ask me why because it makes no sense to me at all), then it will work. But when you don’t, then the row data gets all mucked up.

This is the code that I was orignally using if a user posted an Order Number:

jQuery (".woocommerce-order-received table.shop_table.customer_details tr:nth-child(3)").addClass("billingad");
	jQuery (".woocommerce-order-received table.shop_table.customer_details tr:nth-child(6)").addClass("shippingad");
	jQuery (".woocommerce-order-received table.shop_table.customer_details tr:nth-child(5) td").addClass("rem").appendTo("tr.billingad td");
	jQuery (".woocommerce-order-received table.shop_table.customer_details tr:nth-child(7) td").addClass("rem").appendTo("tr.shippingad td");
	jQuery( "td.rem" ).prepend( "<br>" ).contents().unwrap();
	jQuery (".woocommerce-order-received table.shop_table.customer_details tr:nth-child(4),.woocommerce-order-received table.shop_table.customer_details tr:nth-child(5),.woocommerce-order-received table.shop_table.customer_details tr:nth-child(7)").hide();

I know, a bit excessive right?

Anyways, I’m trying to figure out a way to prevent the data from getting mucked up if a user doesn’t post an ‘Order Number’ during checkout (yeah, stupid idea, I know).


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.