Support » Plugins » Get price from table via. product id

  • Hi
    I am making af woocommerce site where each product contains a tablepress table, which i can get a certain cell value with af shortcode.
    Every product will have its own table, with the table id equal to the product sku.

    In functions.php i have made a filter so the price shown across the site will be equal to the cell value in the table.

    add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
    function custom_call_for_price() {
    global $product, $woocommerce;
    $product_id = $_product->parent->sku;
        echo do_shortcode("[table-cell id=$product_id row=2 column=2 /]");

    The code works if i write
    $product_id=1; instead of $product_id = $_product->parent->sku; even though the sku is set as 1

    NB. i am new to php and woocommerce

  • The topic ‘Get price from table via. product id’ is closed to new replies.