-1

I am modifying a job theme and having a problem with woo commerce plugin

There are 3 products to purchase.
1. posting a job (options: 1job, 2 jobs, 5 jobs)
2. Able to read full resumes for 1 day (option: for 1 day, 7 days, 15 days)
3. Both of them (posting jobs and read resumes)

I have successfully done with setting options and making a payment. But the problem is how I could update these purchase options to user-meta and a custom table.

there is a meta-value called "_Total-amount-jobs" on user-meta. This is for how many jobs he/she can post. like total job amount you can post.
it looks like this _Total-amount-jobs 3 (that means you can post 3 jobs)

there is also a meta-value called "_Resume-expire-day" on user-meta as well. This is for until when he/she is able to read resumes.
the meta-key is date 2013-10-31 17:56:32 (that means you can read resumes by the day)

How can I update user-meta like this after completed payment OR after admin clicks completed button on order list?
it should be plus (+) for jobs amount. and it should be new date for resume expire day

I have found a hook for it. on docs.woothemes.com/document/hooks/ and "woocommerce_payment_complete" but I am not sure how to update.

This is meta for puchased 5 jobs, 7days on wp_woocommerce_order_itemmeta

    280 36  _qty    1
    281 36  _tax_class   
    282 36  _product_id 27911
    283 36  _variation_id   28002
    284 36  _line_subtotal  170
    285 36  _line_total 170
    286 36  _line_tax   0
    287 36  _line_subtotal_tax  0
    288 36  pa_job-posting  5-jobs
    289 36  pa_view-resumes view-7-days

    270 35  _qty    1
    271 35  _tax_class   
    272 35  _product_id 27888
    273 35  _variation_id   27961
    274 35  _line_subtotal  300
    275 35  _line_total 300
    276 35  _line_tax   0
    277 35  _line_subtotal_tax  0
    278 35  Posting Amount  1
    279 35  Location    Normal-listing

please give me a tip or sample source. Thanks

6
  • You are asking a complex question. I would suggest posting the code that you have tried to implement, though even though I couldn't guarantee you'd get a response after that, but at least it won't seem like you are asking for us to do your work for you for free. Commented Oct 26, 2013 at 23:45
  • I am sorry to make you feel bad if you did. this work is for my self. not for someone else. I am just trying to find where (or which hook) I should put and how. Thanks again
    – pulla
    Commented Oct 27, 2013 at 1:55
  • I don't feel bad, I'm just saying that if you showed more code/research effort on your part you might elicit more answers. For example, what isn't working on the woocommerce_payment_complete etc. Either way, the question is borderline off-topic because it is specific to WooCommerce and not WordPress. Commented Oct 27, 2013 at 2:27
  • Thanks for ur time and advice. I have found hook. it's woocommerce_order_status_completed. it took really long time for me as wordpress newbie. please understand me :) but i still have problems lol
    – pulla
    Commented Oct 27, 2013 at 7:22
  • Better questions will help get you better answers is all. And your answer might help someone else, so please an answer with a little code in it then. I understand you might not want to reveal everything you're working on, but you can probably post a simplified version. Good luck! Commented Oct 27, 2013 at 8:01

2 Answers 2

0

This is my solution. I have found that this function (woocommerce_order_status_completed) is for when you made a payment or when you give completed status.

woocommerce_order_status_completed{
function check_quantity($order_id) {

global $wpdb;

$order = new WC_Order( $order_id );
$items = $order->get_items();

foreach ( $items as $item ) {
    $product_name = $item['name'];
    $product_id = $item['product_id'];
    $product_variation_id = $item['variation_id'];
    $pa_version = $item['pa_version'];
}    

..... etc...

}

I am still looking for how I should get variation values. if you know let know. this is what I have found. Thanks,

0

This is my solution. I have found that this function (woocommerce_order_status_completed) is for when you made a payment or when you give completed status.

woocommerce_order_status_completed{ function check_quantity($order_id) {

global $wpdb;

$order = new WC_Order( $order_id ); $items = $order->get_items();

foreach ( $items as $item ) { $product_name = $item['name']; $product_id = $item['product_id']; $product_variation_id = $item['variation_id']; $pa_version = $item['pa_version']; }

..... etc...

} I am still looking for how I should get variation values. if you know let know. this is what I have found. Thanks,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.