Automatically go to shopping cart when appointment is confirmed

Functionally issue: When a user is booking an appointment I need to make it so after they confirm the appointment that it automatically takes them to the cart page. I dont want it to then add the go to cart button. Almost everyone I have had test this site is missing seeing the 'ADD TO CART' button that only pops up after the appointment is confirmed.

I also want to add a button on the cart page. One that says 'Continue Shopping' or 'Book Another Appointment' which links back to the store page or appointment page respectfully.
I see where I can add additional text from within 'MP Store Messages' so I could make a link, but I think a button would be best.

And can the buttons be enlarged? I dont see where it creates them.

As always thank you to everyone who chimes in to help.

  • Alexander

    Hi @Editor,

    Thanks for bringing this up. I'm moving this to the features & feedback section so it can be considered for future development. I'm also interested to here other member's experiences on MarketPress & Appointments+ integration.

    As for the button, this can be done with CSS

    .mp_buy_form {
      font-size: 1.1em;
    }

    Adding that CSS to your theme's stylesheet or with a plugin like My Custom CSS will give you a size increase.

    Best regards,

  • Editor

    Alexander - I wasnt able to get the button size increase using that code in my theme, but thats ok. I REALLY need the other two items though and if you understand the coding it should be fairly easy to accomplish.

    -after confirming an appointment - auto jump to shopping cart. (would replace the 'add to cart button' popping in

    then

    -on shopping cart page - add button "Continue Shopping" Underneath (to allow user to make multiple appointments but only need to pay with credit card once.

    Can you (or anyone) help me here please?

  • Alexander

    Hi @Editor,

    I've looked into this, and I definitely see how the automatic add to cart would be useful. This would save users from needed to "confirm" but them add to cart right away. I also agree about redirecting them to the shopping cart. Otherwise you may even have users who add the booking more than once.

    This would actually take a bit more custom coding than I could provide over support. All of this happens via ajax, and some advanced javascript. This would require custom development, and a bit more than adding a few functions. However, I will definitely bring this to the attention of the plugin developers so it can be considered for future releases of the plugin. It would be good for overall usability.

    As for the other issues, with your product variations, I'm looking into this presently and should be following up on your other thread in a few minutes.

    Best regards,

  • Editor

    No. As Alexander said its custom coding. But I believe it would be a change everyone would like as it removes the confusion from the user. So PLEASE WPMUDEV can we can this update?...After confirming appointment AUTOMATICALLY go to shopping cart pleeeeeasse!!!!

    I added a link at the top of the cart that says SCHEDULE ANOTHER APPOINTMENT and links back to the appointment product page so they can add additional items to the cart and still only pay once (it could say continue shopping and go back to the store page, but currently my client is just appointments).

  • Alexander

    Hi @Editor and @Michel,

    I can agree this would be a great way to improve the MarketPress integration. This has been moved to features & feedback already. I've actually just had to bring the same news to another user today, so I will bring this to the attention of the developer so he can take a look. I can't give a timeframe, or even guarantee that this feature request will be picked up though.

    Best regards,

  • Vladislav

    Hello,

    I am currently working on getting something like this included with the next plugin release. If you're interested, I also have a separate working version of the code abstracted out so you can give it a spin as a mu-plugin or an addition to your theme's functions.php:

    function app_my_auto_add_to_cart () {
    	global $appointments, $post;
    	if (!$appointments->is_app_mp_page($post)) return false;
    	echo <<<EOJS
    <script>
    (function ($) {
    
    $(document).on("app-confirmation-response_received", function (e, response) {
    	if (!(response && response.mp && 1 == response.mp)) return false;
    	$(".mp_buy_form").hide().submit();
    });
    
    })(jQuery);
    </script>
    EOJS;
    }
    add_action('wp_footer', 'app_my_auto_add_to_cart');

    This is what the code snippet will do - it will fire up on each front-end page of your site and check if this page is a MarketPress appointment page. If it's not, it'll bail out and do nothing. However, if it is, it'll inject a bit of javascript to the page.

    This bit of script will then wait for appointment confirmation response and intercept. If all goes well, it will submit the MarketPress form on the page without any interaction from the user. As a side-effect of this action, the appointment will be added to the cart, and the user will be redirected to the cart page.

  • Vladislav

    Hello,

    I'm very happy to hear that the code is working fine for your usage scenarios, thank you very much for the good news. I'd just like to add that as of Appointments+ v1.4 you don't need to be adding the code I added in my post above yourself. The new "Appointments in product cart" add-on has this bit of code integrated in now. Once the add-on is activated, a new option labeled "Auto-add appointments into cart" will be added to your MaketPress integration settings section in Appointments+ settings area. Activating this option will pretty much have the same effect as integrating the code from this thread - but with the added advantage of being able to do it without fiddling with code, and with one less code-level customization to worry about down the line.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.