• Resolved obtenmiweb

    (@obtenmiweb)


    Hello,

    We’re integrating a wordpress/woocommerce database with a third party application. The purpose of the app is to keep woocommerce stock quantity in-sync with the third party app.

    The stock_quantity in the product_meta_look_up table is being updated so the queries are working fine. We’re able to see this on phpMyAdmin but not on the actual website, it keeps displaying the old values.

    I’ve tried incognito browsing in case it’s a cache issue but that didn’t work.

    Help is very appreciated.

    • This topic was modified 5 years, 10 months ago by obtenmiweb. Reason: typo
Viewing 4 replies - 1 through 4 (of 4 total)
  • con

    (@conschneider)

    Engineer

    Hi there,

    I’ve tried incognito browsing in case it’s a cache issue but that didn’t work.

    What does your template file use for getting the value? Is it:

    $product->get_stock_quantity();

    or something else?

    Kind regards,

    Thread Starter obtenmiweb

    (@obtenmiweb)

    I’m using the default template that comes with WooCommerce, the only change I’ve made is in the database. I did try this too and it still doesn’t display the actual DB value:

    Your help is appreciated.

     
    add_filter( 'woocommerce_get_availability_text', 'bbloomer_custom_get_availability_text', 99, 2 );
      
    function bbloomer_custom_get_availability_text( $availability, $product ) {
      $stock = $product->get_stock_quantity();
      if ( $product->is_in_stock() && $product->managing_stock() ) $availability = __( 'Quantity: ' . $stock, 'woocommerce' );
      return $availability;
    }
    • This reply was modified 5 years, 10 months ago by obtenmiweb.
    • This reply was modified 5 years, 10 months ago by obtenmiweb.
    con

    (@conschneider)

    Engineer

    Hi again,

    Let’s try:

    function cowo_get_my_prod_info(){
    
    	global $product; // Get WooCommerce product instance.
    
    	$s = $product->get_stock_status();  // run.
    	$q = $product->get_stock_quantity();
    
    	echo('<h5>Stock info:</h5> Stock status: ' . $s . ' and we have: ' . $q . ' units left.<br><br>'); 
    
    }
    
    add_action( 'woocommerce_single_product_summary', 'cowo_get_my_prod_info' );

    Kind regards,

    con

    (@conschneider)

    Engineer

    Hi there,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Kind regards,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Updating database from third party application’ is closed to new replies.