Display price for products with variations

It seems that products with multiple variations will not show a price on the product listing page, even if all the variations are priced the same.

I would like to find a way to display the price of these items, so the product listing page looks more cohesive and all products are displayed with prices. It’s not really important to me which price is displayed- it could be a “starting from” price, or average, or any of the above. I just need a price to show up on the product listing page.

Any advice is appreciated.

  • digitsoft
    • The Crimson Coder

    If you use a plugin like ExecPHP you can use this code in a product post:

    <?php
    global $wp_query;
    $thePostID = $wp_query->post->ID;
    $prices = get_post_meta($thePostID, "mp_price", true);
    for ($k=0; $k<count($prices); $k++) {
    $pricelist .= '$'.$prices[$k].', ';
    }
    $pricelist = substr($pricelist, 0, -2); //Remove trailing comma
    Echo 'Prices for this item: '.$pricelist;
    ?>

    LMK if you need something a little different because there’s another option.

    Enjoy!

    Rob

  • digitsoft
    • The Crimson Coder

    @mason – always glad to help…love to solve those things :wink: Oooh…a hack-a-thon…maybe this means a bidding war situation for my help? Let’s see…Gina has balloons, Kim has cookies, Joe (aecnu) has hosting, and you have?? lol Anyway…if there is such a thing, lmk.

    @pcwriter – I actually solved a problem in another post using that plugin and some php code…it’s a great plugin!

  • commission
    • WPMU DEV Initiate

    should have read this limitations of marketpress before buying the membership….with all the hype marketing i expected some robustness in the plugin…even woocommerce that came up recently has the variation thing…whats the point of getting someone to pay $79 out of faith and get dissppointed this much …get no refund and probably start spreading bad news about your product all over the net….something as crucial as shopping cart …in this day and age how can a shopping cart just have one variation….just threw $79 away

  • digitsoft
    • The Crimson Coder

    @commission – MP does in fact support multiple variations very easily, but what you’re looking for is how that data is presented. There are plenty of commerce plugins out there and they all have a variety aspects to consider – rarely does one plugin or theme meet ALL criteria for someone. One of the many things you have here is amazing support – may be the best I’ve seen anywhere in the WP realm. Please post a list of what basic things you need/want MP to do…

  • Mason
    • DEV MAN’s Sidekick

    @commission, of course $79 get’s ya access to everything here – hundreds of plugins and we also a lite version of MarketPress for folks to try out ahead of time and see if it fits their needs or not.

    Definitely a bummer if you had different expectations of course. I checked our contact emails and didn’t see where you’ve attempted to get in touch with us about the refund either. :disappointed:

    That being said, we’re happy to assist and do plan our development based on member requests, so if you’d like to join in on the conversation there we’re totally up for that.

    WooCommerce is also a great plugin with a good team developing it. We have different features from that product and they provide many of their most impressive items through paid add-ons. To each his own and we truly wish you the best in finding the plugin that suits your own needs.

    Thanks.

  • bigskinny
    • Flash Drive

    That's a clever hack, and I'm sure it would work great on an individual product page, but I'm talking about the product listing page. Take a look at the attached screenshot. The product on the bottom shows a price because it has no variations. The products listed above the bottom one have multiple color variations and thus, they don't show any price.

    I'd really like to fix this in a way that keeps the look of the site cohesive – in other words, I want to display a price for multi-variation products with the same look and feel as the price displayed for non-variable products.

    Any suggestions?

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    I understand what you’re looking for, but MarketPress doesn’t currently support that configuration.

    So what I’m doing is marking this as a feature request which will alert the developer to what you’re looking for here. I’m sure there are other members seeking this as well so feel free to chime in with your thoughts, ideas, and +1s.

    If this is something you need immediately, I’d encourage finding a competent developer to get this added. We have job boards available for this:

    https://premium.wpmudev.org/wpmu-jobs/

    Thanks!

  • PerkUp
    • New Recruit

    @digitsoft – Really interested in other ways if possible.

    If you use a plugin like ExecPHP you can use this code in a product post:

    <?php

    global $wp_query;

    $thePostID = $wp_query->post->ID;

    $prices = get_post_meta($thePostID, “mp_price”, true);

    for ($k=0; $k<count($prices); $k++) {

    $pricelist .= ‘$’.$prices[$k].’, ‘;

    }

    $pricelist = substr($pricelist, 0, -2); //Remove trailing comma

    Echo ‘Prices for this item: ‘.$pricelist;

    ?>

    LMK if you need something a little different because there’s another option.

    In MarketPress we need Price variation, and a Second type variation. (two drop downs)

  • bigskinny
    • Flash Drive

    @perkup: Those would be awesome features to have as well, but I want to stay on topic here. This post (and subsequent feature request) is to have products with variations display a “starting from” price on the product listing page. I believe that is what the other people posting in this thread are also requesting. See the screenshot in my last post above to see what I’m talking about.

    To reiterate: On the product listing page (not the single product page), no price is shown for products with variations. The PHP snippet that was posted would not solve this problem; it solves a different problem. Again, see screenshot above.

  • great8creative
    • Design Lord, Child of Thor

    Well for those in need of a fix now and don’t want to wait for the next release (or can’t wait, like me) here’s what I got to work:

    – Within the “Edit Product” page, add the common price you displayed by a product with variations – in the EXCERPT field. (I don’t need to use excerpts for anything else really.. so I just figured I’d try utilizing this value)

    – Under Store Settings > Presentation > Product List Settings: make sure you have “Show Excerpts” set to Yes.

    – In plugins/marketpress/marketpress-includes/template-functions.php around line 1648, I blocked out the “Choose Option” and “Add to Cart” pieces… to keep the product list pages clean and simple, and just show the product title, image, and price:

    if ($context == 'list') {
    if ($variation_select) {
    //$button .= '<a class="mp_link_buynow" href="' . get_permalink($post_id) . '">' . __('Choose Option &raquo;', 'mp') . '</a>';
    } else if ($settings['list_button_type'] == 'addcart') {
    $button .= '<input type="hidden" name="action" value="mp-update-cart" />';
    //$button .= '<input class="mp_button_addcart" type="submit" name="addcart" value="' . __('Add To Cart &raquo;', 'mp') . '" />';
    } else if ($settings['list_button_type'] == 'buynow') {
    $button .= '<input class="mp_button_buynow" type="submit" name="buynow" value="' . __('Buy Now &raquo;', 'mp') . '" />';
    }

    – Now add the excerpt, IF that product has one. In themes/framemarket/library/functions/marketpress.php around line 114:

    $content .= '<div class="mp_product_meta">';
    //add last css class for styling grids
    if( $post->post_excerpt ) {
    $content .= $mp->product_excerpt($post->post_excerpt, $post->post_content, $post->ID);
    } else {
    //the_content();
    }
    //price
    $meta = mp_product_price(false, $post->ID, false);

    – Lastly, in plugins/marketpress/marketpress.php I took out the “More Info >” link, again just to keep it clean:

    //replaces wp_trim_excerpt in our custom loops
    function product_excerpt($excerpt, $content, $product_id) {
    // $excerpt_more = ' <a class="mp_product_more_link" href="' . get_permalink($product_id) . '">' . __('More Info &raquo;', 'mp') . '</a>';
    $excerpt_more = '';

    I’m sure there’s an easier way to do this but I’m basically a beginner with PHP… so this is what I got to work. Hopefully this works for anyone else in need!

  • Ollie
    • The Incredible Code Injector

    I ended up finding a fix for this problem a few weeks ago, but most definitely you would need to have a slight understanding of php.

    Here is the product list page with the prices. http://tatestau.com/store/

    You have to duplicate a few of the functions from wp-content/plugins/marketpress/marketpress-includes/template-functions.php to your themes functions.php file

    The functions in particular you need to change the price are;

    mp_product_price

    mp_list_products

    Change the name of those functions when you use theme in themes functions.php file.

    Add a little bit off css and it will work well.

    Cheers

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.