Disable email field on WooCommerce customer account details

You can do it by adding this code to functions.php: function custom_override_checkout_fields( $fields ) { unset($fields[‘billing’][‘billing_email’]); return $fields; } add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’, 1000, 1 ); But it is wrong approach, since WooCommerce uses email to notify user about status of the order.

Woocommerce Membership Expiry Date

According to the documentation, wc_memberships_get_user_memberships() returns a list of WC_Memberships_User_Membership objects. The WC_Memberships_User_Membership class has a get_end_date() method that will return the expiry date. So you should be able to do something like this: // Get memberships for the current user. $memberships = wc_memberships_get_user_memberships(); // Verify that they have some memberships. if ( $memberships ) … Read more

How do I add a “Cancel” button on the subscriptions listing page [closed]

I was looking for the same thing but couldn’t find it anywhere so I tried to do it myself. Here’s my code by the way. Hope this helps. function addCancelButton($subscription) { $actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() ); if(!empty($actions)){ foreach ( $actions as $key => $action ){ if(strtolower($action[‘name’]) == “cancel”){ $cancelLink = esc_url( $action[‘url’] ); echo … Read more

Username field is not shown in Woocommerce’s registration contact form

I just fund the tricky solution, it was very simple and I did think about it. I just went to WooCommerce -> Settings -> Accounts and I untick the checkbox for “Automatically generate username from customer email”. I got the solution from this topic but here the problem was the contrary: https://stackoverflow.com/questions/32781569/remove-username-field-registration-form-woocommerce

How to modify “[Product] has been added to your cart” in WooCommerce?

add_filter( ‘wc_add_to_cart_message’, ‘my_add_to_cart_function’, 10, 2 ); function my_add_to_cart_function( $message, $product_id ) { $message = sprintf(esc_html__(‘« %s » has been added by to your cart.’,’woocommerce’), get_the_title( $product_id ) ); return $message; } The above code will help you to change the message. Since by knowing the hook wc_add_to_cart_message you can improve the code

Where can I find a single item template

The WC single item template is located at: yoursite.com/wp-content/plugins/woocommerce/templates/single-product.php See this documentation: https://docs.woocommerce.com/document/template-structure/ So, you would want to move any of those templates to your child theme under /wp-content/themes/your-child-theme/woocommerce/[any_template_you_want] So, for example, if you wanted to edit the single-product.php but safe from WC updates, you would put the file in this directory and do your … Read more

Issue adding text after short description on product pages Woocommerce [closed]

The Correct syntax for writing a add_filter // Define the woocommerce_short_description callback function filter_woocommerce_short_description( $post_excerpt ) { // make filter magic happen here… return $post_excerpt; }; // add the filter add_filter( ‘woocommerce_short_description’,filter_woocommerce_short_description’,10, 1 ); Your code didn’t work well because the reason is that filter are used to modify the output. Here is the function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)