WordPress.org

Ready to get started?Download WordPress

Forums

WP eCommerce
Item stock not decremented after succes status? (4 posts)

  1. DDT
    Member
    Posted 6 months ago #

    Hello,

    I have added a new payment gateway, after some editing i was able to get emails sends upon success. But item stock isn't decremented.

    How do i get $purchase_log_id from $purchase_log = new WPSC_Purchase_Log( $_REQUEST['sessionid'], 'sessionid' );

    wpsc_decrement_claimed_stock($purchase_log_id);

    I also tried the following code without success:

    case 'idealcheckoutideal':
    //decrement stock
                                if ($purchase_log->is_accepted_payment()){
                                    $sessionid = $_REQUEST['sessionid'];
                                    $processed_id='3';//hardcode
                                    wpsc_update_purchase_log_status( $sessionid, $processed_id, 'sessionid' );
                                }

    also tried

    //decrement stock
             $sessionid = $_REQUEST['sessionid'];
             $processed_id='3';//hardcode
             wpsc_update_purchase_log_status( $sessionid, $processed_id, 'sessionid' );

    If I change the status in wp-admin / dashboard the stock is decremented

    Any pointers, tips highly appreciate

    regards

    https://wordpress.org/plugins/wp-e-commerce/

  2. DDT
    Member
    Posted 6 months ago #

    Ok found a workable solution by adding this to my transaction_results

    if ($purchase_log->is_accepted_payment()){
           $tmpID = $purchase_log->get_data();
           //decrement stock
           $purchase_log_id = $tmpID["id"];
           wpsc_decrement_claimed_stock($purchase_log_id);
                                }
  3. asaracena
    Member
    Posted 6 months ago #

    I haven't added a new payment gateway but I appear to have the same problem. After a product is purchased the stock (always 1 because these are unique items) stays at 1 when it should decrease to zero.

    I can manually fix it but would prefer a less stressful solution.

    I would like to try to add this code but I'm not an expert coder and don't know where exactly to add it.

    Any help on this would be appreciated - website is davidearp.com.

    thanks!

  4. hidvegid
    Member
    Posted 3 months ago #

    Hi,

    I wan't to decrement the stock without geting payment information. I use "manual payment gateway". What should I add in the transaction_results?

    Thanks,

    Dénes

Reply

You must log in to post.

About this Plugin

About this Topic