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
Related
I have a website where each product (food items), lists all the Caloric quantity in KJ. (added as a custom field on the single product page via Woocommerce Nutrition Info plugin)
As the products get added to the cart, I need a total KJ section near the totals, so my customer can see if the mix they are making is appropriate.
Eg. add 1 from A, and 0 to 3 of B, C, D E F. Letters being food items to make their own mix,
Knowing that WooCommerce adds prices, it would make sense that it could somehow do this too in the cart but I'm not smart enough to begin to know how to do it.
I have only limited PHP and Javascript knowledge, so I am totally out of my league and doing my head in.
Does anyone know how to I would add (I'm guessing) custom fields quantities to each other and display a running total to the cart?
I tried writing some code and big surprise it doesn't work, (trying not to be hard on myself but failing abysmally because I'm not a php coder YET!) and I don't know how to make it add up exponentially as products are added to the cart. I have spent weeks googling and Google doesn't understand my question either, hence me reaching out.
add_action( 'nutrition-table-kj', 'kj-value-add-to_cart_function' );
kj-amount-add_to_cart_function () {
$product_id = all;
if ( WC()->cart->get_cart_nutrition-table-kj-value () {
WC()->cart->add_to_cart( $nutrition-table-values );
}
}
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 .
we are showing user meta data and orders detail as well link to user order through $order-get_order_url(). But i can't find anything like this for invoices. Is it possible to get invoice link through order number or id.
meta data
Thanks and Best regards
Thanks to #Shaamii and his Code above, I figured it out how to display only the invoice link!
In #Shaamii code, the order and all invoices are output as a link.
If you edit the invoice in the backend then this and the final invoice are displayed as a link.
But I only need the last invoice and not the cancellation.
Here is my code:
$actions = wc_get_account_orders_actions( $order );
echo $order_invoice = end($actions)['url'];
Can anyone help with a custom hook/code to auto change the post in a category to another category every day at exactly 12:00AM.
I have three categories ( general, special, free )... I have contents with this categories; general & free. So I want any post in the FREE category to change automatically to SPECIAL 12:00AM Daily. So I will have the post in General + SPECIAL category.
I am using woocommerce table rate shipping
In my current system I need to two types of shipping rates
1. Per Order (Based on category )
2. Per Item (Based on category )
The both categories are working fine if the products are separately added
But while I am adding and one products from each categories, in that senarioes I want to both shipping method summation.
Can anyone help me?
Thanks,
Denis
http://www.yiion.com
If you are using the Table Rate plugin from WooCommerce you have to check 'break' when setting up the shipping method.