download button for digital products in membership site

Hi

I have gridmarket and marketpress with membership plugin

How do I get a download link for each product with the tab that says “Download” rather than “add to cart”

I would have expected membership plugin or marketpress has this option.

I have to give members access to download the digital product rather than add it to a cart

Thanks for advice

Glenn

Glenn

  • Alexander
    • DEV MAN’s Mascot

    Hi @glenn,

    MarketPress and Membership aren’t designed to work together in this way. The MarketPress integration in Membership allows you to protect certain pages, but doesn’t contribute to the

    Membership’s main purpose is to restrict access to your site’s content. It wasn’t exactly meant for e-Commerce, but digital downloads are possible.

    A good workaround here would be to add a section to each product with a membership shortcode. If they aren’t logged in, it can prompt them to become a member, or purchase individually. But if they are logged in, it could provide a link to the product’s download URL.

    Best regards,

  • glenn
    • Flash Drive

    Hi Alex,

    Thanks for explanation

    all membership levels will have to log in to download their products of choice.

    and yesterday Patrick gave me the shortcode explanation to protect certain products being downloaded by free members.

    However,

    I need the shortcode or whatever is required to add a download link to each product.

    Do you have the shortcode for this I can try?

    Thanks

    Glenn

  • Alexander
    • DEV MAN’s Mascot

    Hi @glenn,

    I’m sorry for the delay here. This isn’t something that the plugin includes a shortcode for, but I was able to put one together for you:

    add_shortcode( 'product_file_url', 'product_file_url_shortcode' );
    function product_file_url_shortcode($atts){
    global $post;
    extract( shortcode_atts( array( 'id' => 0 ), $atts ) );

    if($id == 0 && isset($post))
    $product_id = $post->ID;
    else
    $product_id = $id;

    $url = get_post_meta($product_id, 'mp_file', true);

    return $url;
    }

    You can place this code in functions.php of a theme (or Child Theme), in your own plugin, or using something like Code Snippets.

    Usage:

    Place this within a product to give that products URL:

    [product_file_url]

    When used outside a product, you can provide the product ID like this:

    [product_file_url id=97]

    Best regards,