This is my first post here and I am really hoping that someone will be able to assist..
I am using woocommerce 2.6 and when the product is in stock (for example invetory of 2) and I make the backorder choice “Allow, but notify customer”, then on the product page I can see 'in stock'.
Then, the notifications displayed in the cart, checkout and subsequent customer emails is showing 'Back ordered: 4'
screenshot
Could you please tell me how I can change the message 'Back ordered: 4' to 'Low Stock'?
I tried to search for the string 'Back ordered' using grep -r "Back ordered" but couldn't find it anywherestrong text
Could anyone please help?
Thank you
Fred
I think you'll find it in /includes/abstracts/abstract-wc-order.php
wc_add_order_item_meta( $item_id, apply_filters('woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ) ), $qty - max( 0, $product->get_total_stock() ) );
And you can also change it in the language file, it is the proper way to do it.
This message is located here :
wp-content/plugins/woocommerce/includes/wc-formatting-functions.php
$display .= ' ' ;// . __( '(can be backordered)', 'woocommerce' );
Related
On a WordPress website I'm using BuddyBoss theme and I've added a glossary plugin.
I'm trying to add a Author Box to under each glossary term, to let site visitors visit the profile of its author. To do this, I've installed a plugin called PublishPress which almost does the job but by default the profile URLs leads to the person's author profile https://example.com/author/hisname/ which should be https://example.com/members/hisname/.
By googling I found a similar solution for another theme:
// FUNCTION
// Change Post's Author URL to Buddypress Profile URL
add_filter('generate_post_author_output','generate_post_author_output_buddyprss_url');
function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
$post_author_profile_link = sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by','generatepress'),
esc_url( bp_core_get_user_domain( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'Know more about %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
) ;
return $post_author_profile_link;
}
I'm wondering how can I customize the script in order to do the exact job. To be honest I'm totally screwed up. Thanks for any help!
I fixed the issue by the pro version of the PublishPress Authors. In the pro version there's a possibility to edit the layout and there's a property returning the BuddyPress Profile Link.
<a href="{{ author.buddypress_profile_link }}"...
instead of:
<a href="{{ author.link }}"...
for some reason the emails being sent to customers after they create a WooCommerce account displays a random name (see attached).
WooCommerce username error
I think because users can create an account with just an email address? But anyway - I want to just remove the Hi xxxx from all email communication from the customer. How do I do this? I am looking at the email templates but can't see how this code is generated?
To remove the name from email communication, you need to copy the email template file in your theme directory (e.g - customer-processing-order.php) on this find the below code:
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
And replace with the below mentioned code:
<p><?php printf( esc_html__( 'Hi,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
Same thing you can do for following Woocommerce email template files:
customer-completed-order.php
customer-completed-order.php
customer-invoice.php
customer-note.php
customer-on-hold-order.php
customer-processing-order.php
customer-refunded-order.php
Thanks - yes that solved the issue. The problem occurred because of a plugin conflict with a translation plugin. Thanks for the response to the question.
I'm using WooCommerce in Japanese and have just modified mail template 'customer-processing-order.php' to display the customer's full name instead of his/her first name.
//before
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
//after
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ) ); ?></p>
This works fine, but the sentence below this is not translated to Japanese any more.
//This sentence is not translated to Japanese
<p><?php printf( esc_html__( 'Just to let you know — we\'ve received your order #%s, and it is now being processed:', 'woocommerce' ), esc_html( $order->get_order_number() ) ); ?></p>
I'm keeping this part intact and before making any changes, this part was translated to Japanese without problem.
Other Sentences following this are still translated into Japanese.
I have problem with just this sentence "Just to let you know — we've received your order #%s, and it is now being processed:"
I'd like to know why and the solution for this.
Additional info:
I modified mail template in admin screen going to:
WooCommerce > Settings > Emails > Processing order > Manage Then I
clicked 'Copy file to theme' button, then modified on edit screen.
WordPress Version 5.5 WooCommerce Version 4.4.1
Thank you in advance.
I want to replace the word "De: " of all products, but I do not know where
Link to website
You can change the "From" text via the woocommerce_get_price_html_from_text filter.
You would do so, like this:
add_filter( 'woocommerce_get_price_html_from_text', 'so_43054760_price_html_from_text' );
function so_43054760_price_html_from_text( $text ){
return __( 'whatever', 'your-plugin-textdomain' );
}
Keep in mind this is WooCommerce 3.0-specific code. I'm not sure it is back-compatible with WC 2.6.x.
I want to add some one check box, one text area and one link before the order details on checkout. I tried to find all over the stackoverflow but I did not found any exact information or code. If anyone help me so I will be very thankful to you. check screen shot for more info http://prntscr.com/9dtloy
add_action( 'woocommerce_review_order_before_payment', 'skyverge_before_paying_notice' );
function skyverge_before_paying_notice() {
wc_print_notice( __( 'Here is some text', 'woocommerce' ), 'error' );
}
I tried this code which is showing something like this http://prntscr.com/9dttsi
Thanks
Have you tried add_action( 'woocommerce_review_order_before_order_total', 'my_custom_fields' );
function my_custom_fields(){
// put your custom fields out here
}
The following hook will add the text before the order details but below the "Your order" text.
//Hook
add_action('woocommerce_before_cart_contents', 'fields_before_order_details');
//function
function fields_before_order_details(){
wc_print_notice( __( 'Here is some text', 'woocommerce' ), 'error' );
}
This is not the only hook that will achieve this, you can find a list of more Woocommerce hooks here.
This is how we can show content right before the "Your Order"
add_action('woocommerce_after_checkout_billing_form', 'fields_before_order_details');
//function
function fields_before_order_details(){
echo 'Terms & Conditions';
}
Thanks all for your contribution