how i can disable Check booking availability and send direct user to make payment in listify wordpress theme. now it send a confirm mail then user can make payment but i want it directly how can i do this any one help please
Use this in function.php
function manage_available_gateways( $gateways ) {
unset($gateways['wc-booking-gateway']);
return $gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'manage_available_gateways' );
Related
I have a WordPress site using the PayPal Checkout plugin for woocommerce.
https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/
I need to change the PayPal item name and I'm using this code in the functions.php, it worked with the normal PayPal plugin but does not work with PayPal Express checkout.
add_filter( 'woocommerce_paypal_get_order_item_name', 'change_paypal_item_name', 10, 3 );
function change_paypal_item_name( $item_name, $order, $item ) {
return 'test';
}
Anyone know the function to change the item name with the PayPal Express checkout plugin?
From a quick look at the code, it seems woocommerce_paypal_express_checkout_get_details is a filter you can try implementing to modify the whole $details array
I have to make two customization on my woocommerce site.
I need to know two main hooks. Someone out there please help me out!
Show custom field values to billing address on order-received page.(I added custom fields on checkout page.)
Need to include these values to customers' order-received email, too.
Thanks for stopping by.
To show custom field in order-received page you have to use
woocommerce_thankyou hook.
Here is the code:
// define the woocommerce_thankyou callback
function action_woocommerce_thankyou($order_id)
{
$my_custom_field = get_post_meta($order_id, '_billing_my_field', TRUE);
}
// add the action
add_action('woocommerce_thankyou', 'action_woocommerce_thankyou', 10, 1);
UPDARED This section after post author comment
To add custom billing fields in WooCommerce email you have to use
woocommerce_email_customer_details hook; this will be displayed just
before the customer details.
Here is the code:
add_filter('woocommerce_email_customer_details', 'custom_woocommerce_email_order_meta_fields', 10, 3);
function custom_woocommerce_email_order_meta_fields($order, $sent_to_admin, $plain_text)
{
$_billing_my_field = get_post_meta($order->id, '_billing_my_field', true);
if ($plain_text)
{
echo 'My field is ' . $_billing_my_field;
}
else
{
echo '<p>My field is ' . $_billing_my_field . '</p>';
}
}
All code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Please Note:
I have assuming that you have added a custom billing fields as $fields['billing']['billing_my_field'] using woocommerce_checkout_fields hook.
All the codes are tested and fully functional.
I'm looking for a way to disappear woocommerce billing address in checkout page when the user is logged in. Is that possible? And in first place, Why is that?! Why billing address form is always showing in checkout page even when the user is logged in?!!!
1) For your question one try this:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
if( is_user_logged_in() ){
unset($fields['billing']);
$fields['billing'] = array();
}
return $fields;
}
2) For your question two :
If user wants to modify something in billing form, this is the place where he can modify nothing else. If you think this is not correct, better to develop a plugin, maybe a lot of people will be thinking this.
I am using woocommerce subscription. It is saving user and makes them logged on once they finish checkout form. How to make like they do not get saved / logged-in until payment success?
You could hook into the woocommerce_thankyou hook and logout the current user there. But that is a little late. Better would be the user to be logget out before the page is displayed, not after.
add_action( 'woocommerce_thankyou', 'my_custom_logout_function_here', 10 );
function my_custom_logout_function_here( $orderid ) {
echo 'Your message here';
wp_logout();
}
I am building an ecommerce site using Wordpress and Woocommerce. I need the site to send out a notification email to the site administrator when a new customer account is registered. I thought this functionality would be built into Woocommerce since it uses the Wordpress user account structure and Wordpress sends new user notifications, but it doesn't appear to be. Does anyone know of a plugin or a function I can use to add this functionality? Thanks!
I'm assuming that you are using html inside emails. If you are using plain text the procedure is similar.
You need to override the woocommerce template structure. Here you can find how: http://docs.woothemes.com/document/template-structure/.
Actually the only file you need to override is your_template_directory/woocommerce/emails/customer-new-account.php.
At the end of this file add this line of code:
<?php do_action( 'new_customer_registered', $user_login ); ?>
In functions.php add this:
function new_customer_registered_send_email_admin($user_login) {
ob_start();
do_action('woocommerce_email_header', 'New customer registered');
$email_header = ob_get_clean();
ob_start();
do_action('woocommerce_email_footer');
$email_footer = ob_get_clean();
woocommerce_mail(
get_bloginfo('admin_email'),
get_bloginfo('name').' - New customer registered',
$email_header.'<p>The user '.esc_html( $user_login ).' is registered to the website</p>'.$email_footer
);
}
add_action('new_customer_registered', 'new_customer_registered_send_email_admin');
add_action('woocommerce_created_customer', 'admin_email_on_registration', 10 , 1);
function admin_email_on_registration( $customer_id) {
wp_new_user_notification( $customer_id );
}
woocommerce_created_customer is hook which is called when user created by woocommerce. It only sends notification to customer. we will use wp_new_user_notification() function to send notification to Admin.
I was pulling my hair out trying to figure this same issue out and after going back and forth with the developers the default is to not send new customer registration notification emails to admin.
After trying various email plugins and even resorting to using WP SMTP Email, I finally decided to leave it alone.
That said, WooCommerce 2.0 was released today so it may be built in the new version.
the answers is in the emails sections of "woocommerce / settings"
simply change the from email to wordpress#yourdomain.com
worked for me as i also had the same issues
To notify admin whn new user has registered use:
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );
function woocommerce_created_customer_admin_notification( $customer_id )
{
wp_send_new_user_notifications( $customer_id, 'admin' );
}
See documentation on https://woocommerce.com/document/notify-admin-new-account-created/