• Resolved curiositykillsthecat

    (@curiositykillsthecat)


    Hello,

    Thinking of getting either the Table Pro or WooCommerce, but there is one important requirement is that the table needs to be able to get product quantity from an external database. Is that possible with either Pro version?

Viewing 1 replies (of 1 total)
  • Andy Keith

    (@andykeith)

    Hi,

    Yes you could do that in either Posts Table Pro or WC Product Table. You would need to initialise your external database somewhere (e.g. on the ‘init’ hook) then add your custom column to the shortcode like this:

    [product_table columns=”name,price,external-quantity,add-to-cart”]

    (Assuming you’re using Product Table, but you could do the same in Table Pro).

    You then need to add a filter to fetch the external quanitity, e.g.

    
    add_filter( 'wc_product_table_custom_data_external-quantity', 'wcpt_add_custom_data_external_quantity', 10, 3 );
    function wcpt_add_custom_data_external_quantity( $value, $post, $product ) {
        $value = // fetch from external DB
        return $value;
    }
    

    Hope that helps.

    Andy

Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible to get data from external database?’ is closed to new replies.