How to cut percentage from sales with Marketpress Multisite

Dear community,

after long hours searching and reading tons of threads
I'm still not clear on how to sort this.

The site I'm building should operate like Etsy.

I understand Global Cart does not allow for Paypal Chained Payments, but I need to have a Global Cart to show the buyer all their picked items from different stores.

From what I've seen, Etsy shows all items from each store in a different box, allowing to checkout and pay for each separately. What they do then, is this:

"Fees for listings and transactions are accrued on your monthly Etsy bill. At the end of each month we add up all your fees, and we email your monthly statement to you. You must pay your bill by the 15th of the next month using either the credit card on file or PayPal."

So my questions are:

1 - Is it possible to have Marketpress allow for independent checkouts for each store?

2 - If the checkout mechanism is for all items in one go, how does each store owner get the payment? Is it that the Paypal Business Account set up at the master WP takes care of routing buyer's payment to the respective stores?

3 - Is there any recommended way for billing a cut to each store for their sales every month?

I could do some coding, however my deadlines are pretty tight.

Thanks in advance!

  • Alexander
    • DEV MAN’s Mascot

    Hi @Ramiro Cosentino,

    To get started, unfortunately you must choose between PayPal chained payments and the global cart. Chained payments is what allows you to take a portion of each sale. Global cart is what allows users to make one payment, and MarketPress will split it between all vendors.

    Because both of these interact with the PayPal API quite differently, they both can't be used.

    1 - Is it possible to have MarketPress allow for independent checkouts for each store?

    Sure, this is possible by disabling the global cart. Users will need to checkout at each store individually - but you can in this case enable the chained payments gateway allowing you to take a percentage of each sale.

    2 - If the checkout mechanism is for all items in one go, how does each store owner get the payment? Is it that the Paypal Business Account set up at the master WP takes care of routing buyer's payment to the respective stores?

    Each vendor will need to have their PayPal email address setup in their store. Then your PayPal application does the rest. It uses the PayPal email addresses from everyone involved in the transaction. The grand total is taken from the user and sent to PayPal where it is then split among the recipients.

    3 - Is there any recommended way for billing a cut to each store for their sales every month?

    I'm sorry no, we don't have a method of doing this. With custom development, it's possible the retrieve all the stores orders and track totals. Then you could know exactly how much each vendor owed in fees. The orders are just stored as custom post types on each site. Then you'd need a way to invoice them based on that amount.

    Best regards,

  • Ramiro Cosentino
    • Flash Drive

    Thanks a lot @Alexander Rohmann for your clear feedback!

    I have more questions, please:

    1 - Is it possible to have MarketPress allow for independent checkouts for each store?

    Sure, this is possible by disabling the global cart. Users will need to checkout at each store individually - but you can in this case enable the chained payments gateway allowing you to take a percentage of each sale.

    Right, I got that. But disabling the Global Cart is not an option for this project, where the main site should behave as a frontshop which includes all existing sites on the network.

    Digging around I've found this 'workaround':

    global $mp;
    $cart = $mp->get_cart_contents(true);
    var_dump($cart);

    Source:
    https://premium.wpmudev.org/forums/topic/marketpress-global-cart#post-140719

    If I get it right, based on that piece of code, it should be possible to write something for displaying each sub-store's cart contents on the main site, isn't it?
    Each could show up in a different box with it's own checkout button and shipping information, etc. the way Etsy does.

    Do you know of any sample code I could look at to develop that feature? Strange that it's not there yet.

    I thin It would be the solution many people is waiting for, in order to have chained payments, by having the Global Cart disabled, and having this "Summary of carts" for each shop independently but displaying on the same page.

    Does it make sense?

    Regarding question #2, all clear, thanks! In fact I've set up a Paypal Sandbox account for testing, and it happened exactly what you explained.

    Regarding question #3, all clear too. I might develop that myself in case doing the "Summary of carts" results too messy or time-consuming.

    Thanks again!

  • Alexander
    • DEV MAN’s Mascot

    Hi @Ramiro Cosentino,

    I'm sorry I don't have full code sample for this, and it hasn't yet been developed. I do know that we have some features in the works to improve the checkout process and offer options to make it more like etsy - but I don't have an ETA on this or know what it's priority is.

    I can however give you an idea of how to work with the data returned by that function. What you'll have is an array of blog ids each containing an array of products, then any variations.

    So you could iterate over these with nested foreach loops:

    foreach ($cart as $blog_id => $site_products) {
        // Use $blog_id to get blog specific info here
    
        foreach ($site_products as $product_id => $variations) {
    
            foreach ($variations as $variation) {
                $data = get_post_meta($product_id,'key');
            }
        }
    }

    Haven't tested this, as code specific support is part of a gold membership - but this should get you started. You can also refer to the function code for get_cart_contents in marketpress.php on line 2649

    Best regards,

  • Ramiro Cosentino
    • Flash Drive

    Thank you Alexander! That helped already :slight_smile:

    I'm now on the right path it seems.

    I will use the standard Marketpress method, which is a unique checkout with Paypal Express Checkout and then run some custom code to calculate the total orders and bill a percentage to my store owners.

    I'm marking this as resolved.
    Thanks again and all the best!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.