Allow only one item in checkout

Hello,

How can I enable MarketPress to only allow one item to be purchased in each order? So the user cannot checkout with more than one item.

Thanks,
Ian

  • Jack Kitterhing
    • Code Norris

    Hi there Ian,

    Hope you're well today and thanks for your question.

    Out of the box no, but I've attached a custom plugin to enable this, just upload and activate.

    On the product, create a custom field called, mp_track_limit and set it's value to 1.

    Then create a mp_limit and set your maximum order quantity to 1.

    Sorry for the manual work on that part, I'll improve the plugin later, but for now that works :slight_smile:

    Thanks!

    Kind Regards
    Jack.

  • Ian
    • Design Lord, Child of Thor

    Hello Jack,

    Thank you for the reply and for supplying the plugin. However, I am unable to get it to function properly. I have Appointments + installed and it's using MarketPress to process on-site transactions. So the product in MarketPress is the service. I have installed the plugin and set the custom fields for the product, "mp_limit" and "mp_track_limit" to values of 1 each. However, I am still able to go through the checkout process with multiple products (appointments) in my cart.

    What could be the issue?

    Best,
    Ian

  • Jack Kitterhing
    • Code Norris

    Hi there Ian,

    Hope you're well today,

    I've discussed this with the lead developer and appointments+ won't acknowledge them custom fields and their limits.

    Rather, you could try using the filter of mp_product_id_add_to_cart to check against the cart ID, but that would still allow them to book multiple appointments, with different ID's, but not the same appointment.

    I've added this as a feature request for you :slight_smile:

    Thank you!

    Kind Regards
    Jack.

  • Ian
    • Design Lord, Child of Thor

    Hello Jack,

    Ok, thanks for the reply. Another way in which I was trying to accomplish this was to have the user's browser session cleared once they go to the calendar booking page. This way they couldn't keep adding appointments to their cart. Do you know how this might be achieved?

    Best,
    Ian

  • Ian
    • Design Lord, Child of Thor

    Right, but that would be the goal. To reset their cart so they could only checkout with one appointment. They would confirm an appointment on the [app_confirmation] page and then be directed to checkout with the one appointment.

    This works, but the issue now is that once the user confirms the appointment it automatically gets booked and marks it as such on the calendar. So they could "confirm" several appointments in a session by going back to the calender page and changing their date/time and confirm a new appointment. Therefore the "confirmed" sessions would all be booked up on the calendar. Ideally, I would like the confirmation action that is currently in the [app_confirmation] shortcode to be at the very end of the checkout process. This would mark the calendar time/date as booked only when the user has finished the process of checking out.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.