Edit error message in woocommerce cart page - woocommerce

I want to edit the following message displayed by woocommerce in the checkout area
" No shipping methods were found; please recalculate your shipping or continue to checkout and enter your full address to see if there is shipping available to your location"
The message appears if the buyer is not from an approved country, I want a message that says "for a shipping quote email (email address)"
Could you tell me/how where this is done please.
ATB
Mark

Edit the file "cart-shipping" in /plugins/woocommerce/templates/cart/
The text to edit is around line 72 (Woocommerce Version 2.2.8)
Edit the echo'd html/text between the <p>' . __( ' and ' ) . '</p>
(In other words, you can add html elements inside an echo statement.)

Related

Display a "USER" ACF Field on Woocommerce Orders Detail Page

I hope someone can kindly help with our Woocommerce problem.
I've been stuck looking for examples on how to display an ACF (Advanced Customs Field) field on the Orders Details Page. The difference with my query to others is that the ACF field is set against user information. So in the ACF Field group, I have set "User Role" "is equal" to "All". This works fine and the field can be seen when viewing USERS in the backend. Via the ACF plugin, it will save data against the user.
The field label is "Credit Account Status", and field name is "credit_account_status". Its a checkbox field with 3 options:
Active - No credit given
Active - Credit OK
ON STOP - credit removed; see Accounts Dept.
We want to call up this field when viewing orders on the Order Details page - maybe underneath the shipping address section at the top of the order page. We want this as a visual to prevent us raising new orders manually for someone who hasnt paid their bills on time!
Can anyone help please?
I previously tried to edit the below code, but my programming is very poor - this code seems to bring in data from Order meta, not USER meta.
/**
Display field value on the admin order edit page..
PHP Custom Feild Value
*/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo ''.__('Store Location').': ' . get_post_meta( $order->id, 'My Field', true ) . '';
}
Best wishes, Craig

Remove payment details Woocommerce order's page in backend

I see a post about to translate or change the text "Paid on" on woocommerce backend order's detail page. I integrated it for bacs and local pickup payment.
Replace a specific word for BACS payment method in Woocommerce order edit pages
What I need to add if I want not display the "Paid on" message also when shop manager before set the status to processing (so payment details appears) and then turn back to "wait for payment" or a previous status?
Image attached: Order status is Deleted but it always show the payment details from Completed status set before
Thanks
Update:
Black fields are done because I want to hide real customer informations because I'm sharing the screenshoot here :D
This is to replicate the problem:
Customer makes the order
Order has a initial custom status created from me called "Verifying Stock"
Shop manager make the iter about the stock availability and then set the status to Wait for payment (Bacs or local payment at local pickup)
When shop manager set the status to "Processing", on the header appears the information about payment: "Paid on " and "IP: ..."
If the shop manager set a previous status of "processing", for example "wait for payment", the information "paid on" remains forever, i cannot remove them or update again.
I need to remove details if the order status is different from processing or completed order status.
Thanks
As you shared the screenshot I implemented the logic for you.
You can try this for temporary hide billing, shipping address and IP address
add_action( 'woocommerce_admin_order_data_after_order_details', 'hide_custom_details' );
function hide_custom_details($order) {
$status = array('processing','completed','refunded','cancelled');
$order_status = $order->get_status();
//if(!is_admin() && !in_array($order_status, $status)) {
if(!in_array($order_status, $status)) {
?>
<style>
#order_data .order_data_column:nth-child(2),
#order_data .order_data_column:nth-child(3),
#order_data .woocommerce-order-data__meta.order_number .woocommerce-Order-customerIP{
display: none !important
}
</style>
<?php }
}
If you want to update more, so first Inspect(ctrl+shift+i) and copy class/id as you want to hide and paste inside given CSS.
If you want that, the admin can view every detail then add "!is_admin() &&" inside if the condition like commented if conditions.
you can also update the status accordingly.

Hide Place Order button when no shipping options are available

My woocommerce shop is UK based, selling bulky items to both the UK market and internationally using FedEx.
I use FedEx for international shipping but sometimes an address cannot be shipped to and the customer gets the 'no shipping available' message. However, as far as I can tell, Woocommerce STILL allows the customer to place the order in these situations resulting in an order that cannot be fulfilled. Is there a simple setting somewhere that I am missing that says if no shipping is available, don't let the order be placed?
I did find this resource - https://www.bolderelements.net/support/knowledgebase/removing-checkout-button-shipping-not-available/ but that only removes the ability to get to the checkout page.
It seems like there should be a setting for something this basic?
I ended up solving this by not hiding the button, but by forcing an error if there is no shipping. I'm using the woocommerce_checkout_process action for this:
function is_valid_shipping() {
$selected_shipping = WC()->session->get('chosen_shipping_methods');
if(in_array(false, $selected_shipping)){
wc_add_notice( __( 'Your Shipping is not valid.' ), 'error' );
}
}
add_action( 'woocommerce_checkout_process', 'is_valid_shipping' );
Hope this helps someone else!

CFDB plugin : Preventing Duplicate Submissions from CF7

I have a form where user add his email address, I’m trying to prevent users to enter there email many times. I use "contact form to database plugin" to save email address and export them to excel. while searching on internet I found this solution (link below) but I can’t get it work can you help me please :
https://cfdbplugin.com/?page_id=904
Thanks
I found the solution,
in the line where you put the name of the form you should put the title of the form (line bellow ) :
$formName = 'email_form'; // Change to name of the form containing this field
so, for exemple if we have created with the contact form 7 a form here is the shortcode that we will have :
<?php echo do_shortcode( '[contact-form-7 id="69" title="Email_form" html_name="my_form"]' ); ?>
what I did is I put the value of html_name in the script of CFDB but when I changed to the value of title it works

How to remove woocommerce check out page's default email address text

By default email field is showing email address from wordpress general settings , I want to show a custom text like 'example#example.com' in this field as a place holder value. Please advise
None of the answers solved my problem either...
Took me a while to work this out, really simple in the end, just put this at the end of your functions.php file and change the value to whatever you want.
function woocommerce_change_checkout_field_value() {
echo "<script>document.getElementById('billing_email').value = 'Your value here';</script>";
}
add_action( 'woocommerce_after_checkout_form', 'woocommerce_change_checkout_field_value');
Go to your dashboard -> Woocommerce -> Settings -> Emails -> Email options, you will see ""From" Name" and ""From" Email Address", change those and it should change it on the email.
More information about configuring some of the basic options on woocommerce you can visit this page.
You need to implement checkout field customization hook for doing this. Its correct way of doing it.
Please refer to this : https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
get WooCommerce Checkout Manager
then complete Replace Placeholder Name of your field.

Resources