Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter famouswolluf

    (@famouswolluf)

    I have figured it out:

    $shipping_class_id = $product->get_shipping_class_id();
    $shipping_class= $product->get_shipping_class();
    $fee = 0;
    
    if ($shipping_class_id) {
       $flat_rates = get_option("woocommerce_flat_rates");
       $fee = $flat_rates[$shipping_class]['cost'];
    }
    
    $flat_rate_settings = get_option("woocommerce_flat_rate_settings");
    echo 'Shipping cost: ' . ($flat_rate_settings['cost_per_order'] + $fee);
    • This reply was modified 8 years, 4 months ago by famouswolluf.
    Forum: Hacks
    In reply to: Filter products by price
    Thread Starter famouswolluf

    (@famouswolluf)

    I have fonud the solution.
    It is an (old) mysql bug: https://bugs.mysql.com/bug.php?id=61691

    I have changed it to:
    $query->set( 'meta_type', 'DECIMAL(20,2)' );

    Forum: Hacks
    In reply to: Filter products by price
    Thread Starter famouswolluf

    (@famouswolluf)

    I made some progress by adding:
    $query->set( 'meta_type', 'decimal' );

    But when i fill in 10 as minprice and 20 as maxprice I also get results like 9,86 and 20,30.

    When i fill in 10.50 as minprice and 20 as maxprice, everything before 10,50 is gone as it shoot, but 20,30 is still there.

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