Change the paypal item name in the PayPal Express Checkout plugin - wordpress

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

Related

how to change capture_method in stripe for particular product in checkout woocommerce

we have been using WooCommerce Stripe Gateway plugin.which provide capture method as manual or automatic.But if it set any of one on admin,the selected option will be apply for all product on checkout. we need change change capture method for one category product to manual in checkout. is it possible with following filter
wc_stripe_payment_metadata
the following filter worked .
add_filter( 'wc_stripe_generate_payment_request', 'change_cap',2,3 );
function change_cap( $post_data, $order, $prepared_source ) {
$post_data['capture_method']='manual';
}

Disable Check booking availability from listify theme wordpress

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' );

Woocommerce removes shipping labels from cart and checkout

I am selling services using Woocommerce and have enabled shipping address on checkout using snippet, which works fine.
In order to avoid error on checkout, I have to enable free shipping. I do not want the label Shipping: Free Shipping to be shown on Cart and Checkout. Tried using the following snippet, but it didn't work. Please help.
add_filter( 'woocommerce_cart_shipping_method_full_label', 'remove_shipping_label', 10, 2 );
function remove_shipping_label( $label, $method ) {
$new_label = preg_replace( '/^.+:/', '', $label );
return $new_label;
}
You can disable shipping in the woocommerce settings.
To force clients to fill in their adress to ship your products to, copy and paste the following code in to your functions.php file
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true', 50 );
So basically your free shipping label goes away because you disabled shipping and the costs etc but clients still need to fill in the address fields.
Hope this helps!

Woocommerce clear cart after payment

I'm having trouble clearing my cart after payment but I'm using Woocommerce.
I used codes and plugin from an older site (before the major update in the beginning of the year) and that doesn't seem to work now on the new updated site.
This is the functions.php
// check for clear-cart get param to clear the cart
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
if ( isset( $_GET['clear-cart'] ) ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
}
}
In the thankyou.php that appears after succesfull payment this code is in there.
<!-- clear cart after successfull payment -->
jQuery(function($) {
$.post("http://ihavetakenoutmydomain.org?clear-cart",{},function(response){
var NewCart = $(response).find('#header-cart-inner');
$('#header-cart').html(NewCart);
var NewCartItems = $(response).find('.cart-items-inner');
$('.cart-items').html(NewCartItems);
});
});
I'm using the same theme as in the older version so the header-cart-inner and header-cart are the same.
But for some reason this doesn't work with the updated Wordpress and Woocommerce.
Does anyone know what the problem might be or have another solution for clearing the cart after succesfull payment? The thankyou page should only appear after successfull payment.
I forgot one thing
If I load the link "xxx://ihavetakenoutmydomain.org?clear-cart" on my browser the cart empties. So I guess the problem would be how to activate the link on the thankyou page without redirecting away from the thankyou page.
Best regards

Woocommerce New Customer Admin Notification Email

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/

Resources