MarketPress: How to show customer how much weight he can add before paying more shipping

We ship from Peru worldwide. The shipping costs are weight and region related. As an example (to the US): From 250g on: 21 USD, From 500g on: 32 USD, from 1kg on: 53 USD.

There are articles which are very light (like necklaces under 100g), and other ones around 400-900g (weavings).

To make the best out of the high postage means being as close as possible to next weight interval.

(1) How can I show to a customer the difference of weight left to the next weight interval?

(2) How can I show recommendations of products fitting into the weight difference between the total weight of products in his cart and the next weight interval?


Customer has a weaving in the cart (700g).

I want to show a message like “for the same shipping cost you could add….” and then it shows a list of products all weighing less than 300g (because the next weight interval with 21 USD more of shipping costs starts with 1kg).

Thank you for any hints!!!

  • Kasia Swiderska
    • Support nomad

    Hello Emanaku,

    I’m afraid that MarketPress does not have that option and it would require custom coding to achieve that.

    I’m not sure right now if this is possible with quick snippet code – but let me ask one our devs if they can help with that. Please note however, that this is a custom development and I cannot guarantee anything upfront. If you need help on this urgently please post a question on a “Jobs & Pros” job board (please note: no WPMU DEV staff involved) here:

    kind regards,


  • Panos
    • SLS

    Hi Emanaku ,

    Interesting idea :slight_smile:

    I doubt though, that this can be included as a plugin feature. However there are some hooks available which you can use. I have prepared a mu-plugin (which can be used as plugin also) which you can find here:

    This should add a new line under the “Estimated Shipping” raw in the cart containing the weight left for the next step. You can of course modify it according to your needs (eg change labels)

    Hope this helps!

  • Emanaku
    • The Incredible Code Injector

    Hi Panos,

    wow – that is way more, than I could have hoped to receive!

    I adjusted a couple of things (see below), and was able to have additional products offered in the cart like this:

    (the example is not very impressive, because in this test installation I have only two products :wink: ).


    1. The function for sorting was missing – I copied it from class-mp-cart.php and reversed the sort order (to "sort ascending":wink:.

    2. I tagged all products with tags like "100", "200" etc. meaning their weight is up to 200g.

    3. I added the search for the respective tag with mp_list_products.

    What I still need:

    a. is there an easier way to search for products by weight?

    b. can I limit the number of results of mp_list_products to (e.g.) 3 products?

    Thank you very much!

  • Panos
    • SLS

    Hi Emanaku ,

    I would suggest a custom function, slightly modified version of mp_list_products. I have prepared a snipped which you can use as a mu-pluggin which provides a shorcode which you can use:

    [wpmudev_products_list weight="0.3"per_page="3"]


    $weight = 0.2;
    echo do_shortcode( '[wpmudev_products_list weight="' . $weight . '" per_page="3"]' );

    You can download the mu-plugin from here:

    Let me know if this helps!

  • Emanaku
    • The Incredible Code Injector

    Hi Panos,

    thank you so much for this code snippet of a customized version of mp_list_products.

    I tried to work with it, and I nearly (!) got it done, but I ran into these problems:

    (1) to find the products with a weight say between 0.3 and 0.4 kg I used the meta_query

    $meta_queries[]= array(
    'key' => 'weight_pounds',
    'value' => array( $atts['weightmin'],$atts['weightmax']),
    'type' => 'DECIMAL(1,1)',
    'compare' => 'BETWEEN'

    But the main confusing thing is, that all products with variations show up in the resulting list. And I do not know, how to find the minimum and/or maximum weight of these variations, or – maybe simpler – how to exclude products with variations completely.

    (2) When the productlist is shown, it is shown in the cart, but also on the checkout page in the last step “Review Order/Payment”. Not only do I not want it there, but it messes up the “Continue” button, which is suddenly replaced by an “Add to Cart” button (how can that happen???).

    So I tried to hide the list at the Checkout page by using a code line like:

    if(MP_Public::get_instance()->is_store_page( 'checkout' )) return $order_total_line;

    But this test (found it somewhere in the template-functions.php) never succeeds – it just result in an empty string.

    I would also be happy, if there is a simple test, if the code is executed on the cart page….

    Thank you very much!

  • Panos
    • SLS

    Hi Emanaku ,

    I didn’t check with variations sorry, but it shouldn’t include them as they have different post_type “mp_product_variation”. Have you added this post type in your query? Sorry for asking, I can’t replicate.

    Regarding your second issue, I tried the following and seems to be working:

    if( ! mp_is_shop_page( 'cart' ) ){
    return $shipping_line;


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.