Order due on woo commerce says "Due Immediately" - woocommerce

Summary: When someone places an order [if the payment is due] and at the top next to the tax invoice, it says “Tax invoice – due immediately”. I feel those words are a bit too aggressive. How can I change it to – Payment Due?
I am trying to fix he output on the pdf invoice by wpovernight. I am customizing the template. On the tax invoice for a bank payment it says due Immediately,
which is printed by <?php do_action( 'wpo_wcpdf_after_document_label', $this->get_type(), $this->order ); ?> this line.
That means the order details is from woo commerce, I tried to find the string "Due Immidiately" in woocommerce.
$string = WC_Order_Item_Product::get_type();
I saw some documentation but I couldn't do it. Any help will be appricaited .

Related

WooCommerce ignoring decimal price

I have a WooCommerce 7.0.0 shop for which I'm programmatically creating products.
The price of these products is calculated according to various user input values.
I've done it before on other sites without problem, but I'm currently facing an issue : when the calculated price is a float, on the review order table, the price is not displayed correctly, and I'm getting a notice : A non well formed numeric value encountered in class-wc-cart.php on line 2151
Eg. if the price is 5.24€, I get 5.00€ on the product detail, subtotal, and total of the cart.
However, the price is displayed correctly as 5.24€ in the back-office.
Also, it is stored correctly in database.
Here's 2 methods I've tried to save the price before getting to checkout :
// Method 1
$product->set_price($total);
$product->set_regular_price($total);
$product->save();
// Method 2
add_post_meta($pID, '_regular_price', $total);
add_post_meta($pID, '_price', $total);
I tried various casting and rounding methods before saving (flotval, number_format, sprintf('%.2F') ) to no avail.
I also tried both , and . separators on the WooCommerce settings.
I'm running out of ideas, I must have missed something obvious but as it is, I can't put my finger on it.
Maybe something has changed on the newer versions of WooCommerce ? The last version I've used where I created products in the same way without issue, was 6.3.1.
Any help is welcome :)
Thanks,

Woocommerce - let customer pay for order when order column value is late payment

I have a difficult problem which i'm trying to solve for some time now.. We are using plugin called admin customer order fields, which let's to create a new column for order. For this part I have made second order status which is called "Payment status" - it can be not paid, paid, or late payment. And these statuses work depending on payment type. For example if customer pays via bank, status becomes "pending" and second column becomes "not paid". But the problem is that we are using Partial Payments plugin, which let's customer to pay for order after some time, for example 30 days. But during these 30 days the product will be shipped to his address and he can pay for order later. The logic is like this:
Customer orders product with option to pay after 30 days.
Order status becomes processing / payment status becomes not paid
And administrator can change the order status - if he ships it it becomes completed. So the statuses would be:
Order status - completed / payment status - not paid. And it should still let user to pay for the order even if order status is completed
Is it possible to make, that it customer could pay for order depending on payment status, not default order statuses? As the best what I have found is this hook:
woocommerce_valid_order_statuses_for_payment
But you can only make that the order statuses could be valid for payments, but I need to make it on payment status which is made with custom plugin.
Attaching screenshot to be clear as possible.
The idea is to make that if payment status is "APMOKĖTA" you couldn't pay anymore, and if it's "ATIDĖTAS MOKĖJIMAS" you could pay for your order.
You can try using the woocommerce_order_needs_payment hook like this
add_filter( 'woocommerce_order_needs_payment', 'custom_needs_payment', 10, 2 );
function custom_needs_payment( $needs_payment, $order ){
$payment_status = get_post_meta( $order->get_id(), 'payment_status', true );
if($payment_status == 'APMOKĖTA'){
return false;
}
return true;
}
You might need to change the names of the post meta to whatever it's named on your end

Creating WooCommerce placeholder for Emails sent

My client, a courier company, is using delivery software that is able to track with both WooCommerce order no. and ID, which means it requires both order no. and ID ("wc_order_abcdefg") to work, I believe this falls in the phpmyadmin database of post_password column.
Full tracking ID goes like: wc_order_abcdefg.66
So in the WooCommerce email settings, it only has {order_number}. How do I create one for {order_id}?
It looks like, your shipment tracking number is {order_key}.{order_number}.
Once you get hold of the order object, you can get its key simply with: $order->get_order_key().
{order_key} is not available as an email placeholder. So in order to include it in the email sent to the customer, you have different options depending on where you want it to be displayed. For example:
You could include the tracking number in the body of the email. In this case, you can override one of the WooCommerce email templates (e.g. email-order-details.php). See the WooCommerce docs for more info on how to override templates.
You could include the tracking number in the subject of the email. In this case, you can use the woocommerce_email_subject_customer_completed_order filter. E.g. (this snippet should be added to your functions.php):
add_filter( 'woocommerce_email_subject_customer_completed_order', 'add_tracking_number_to_email_subject', 1, 2 );
function add_tracking_number_to_email_subject( $subject, $order ) {
return sprintf( 'Thank you for your order! Your shipment tracking number is: %s.%s', $order->get_order_key(), $order->get_id() );
}

Big Commerce Cart Subtotal global variable name

I've asked Big Commerce on their community forum and in the help (chat) - I'm after the GLOBAL variable name for the cart subtotal.
I need to include this in my invoice / tax receipt email.
Currently I just add this to the bottom of my standard Invoice.
RECEIPT FOR DONATION
Received from: %%GLOBAL_ShipFullName%%
Amount: %%GLOBAL_SideCartTotalCost%%
Date: %%GLOBAL_DatePlaced%%
__
NB: the SideCartTotalCost doesn't survive as a variable through to the Invoice stage, so nothing is displayed in the email sent to purchasers.
Any thoughts or suggestion most welcome. I have a case open with Big Commerce but so far nothing has come from that.

Show total sales per author in woocommerce

I'm using wordpress and woocommerce on a site where I have users create accounts so that they can upload their own clothing designs, I then sell these products and for each sale of their design the specific user gets a cut of the sale. I am trying to show the number of sales for each user on my site but can't figure out how to. I just need to be able to call the products created by each user specifically and then get the total sales from each of those products, then combine them into a total sales number for each individual user... can anyone point me in the right direction??
I am able to get the total sales for a single product using the
<?php echo get_post_meta($post->ID, 'total_sales', true); ?>
but I have no idea how to get it for a specific for a user.
<?php echo wc_get_customer_total_spent($user_id); ?>
You can use this flow:
Put author support on product post type
Get all products posted from that author
Get total sales for all listed product (refer point 2)
Hope this will be useful. :D

Resources