Redirect to checkout page after making an appointment

I have the Appointment+ integrated with MarketPress plugin. Once an appointment is made there's no clue that it's added to the cart. Choose the option to redirect to cart page but that doesn't work for appointments.
Is it possible to redirect to checkout after an appointment is made or even show a pop-up to user?

  • Predrag Dubajic

    Hey Federico,

    Hope you're doing well :slight_smile:

    Can you tell me where exactly are you booking an appointment from, do you have a page with your appointments or you're using MarketPress Product with the shortcode?
    Thing with MP and A+ integration is that you should use the MP product, and you actually have one created here: yourdomain.com/make-an-appointment/appointment/

    The thing is that your page is throwing an console error when I select the date and it doesn't show timepicker so I can't book an appointment.
    Once appointment is booked it should show a link to cart like this:

    Now, because of the console error I couldn't check what's happening on your installation exactly.
    Can you try disabling your other plugins and switching to default WP theme so we can see if there's some conflict on that end that's preventing calendar to work properly?

    Best regards,
    Predrag

  • Federico

    Hello Predrag!

    Thank you so much for your assistance.
    Appointments are booked from this page: https://charterstthomas.com/reserve-your-charter/, I'm using Appointments + for this.
    When I go to charterstthomas.com/make-an-appointment/appointment/ it does not let me select a date, I don't mind switching the appointment page; just need to fix the issue with the date selection. I see you mentioned the console error, not quite sure what that means =(

    In regards to switching off the plugins, the site is live and would rather not take it down, I have support activated on the site and if you're able to, you have my full permission to enter the site and make edits/test as necessary. If that's not possible, please let me know how to proceed. Thank you!!

  • Predrag Dubajic

    Hi Federico,

    With MarketPress integration you need to use MP product as a page for booking an appointment in order to add it to cart.

    Sorry for lack of the info about the console error, this means that browser is showing an error in console when you inspect the page with dev tools and in this case there's some script failing due to that error.

    Unfortunately the error only shows this:
    Uncaught SyntaxError: Unexpected token <
    It looks like there's something in code not closed properly but the error doesn't tell us where exactly.
    I did notice that you had file manager on your installation so I used that to download your active theme and plugins in order to test it on my installation and it looks like the issue is coming from your theme.

    When I have all of your plugins and theme active on my installation I can see the error as well, and as soon as I switch to default WP theme the calendar is working fine.

    I tried check the theme files but couldn't figure out what's causing the issue, can you get in touch with the theme developers and ask to have a look at this as they are more familiar with their own code and could give us more info about what's going on?

    Also, is your theme on latest version? It seems like there was an update to that theme in September but your version is 1.0.0 which look like initial release of the theme?

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello Federico!

    I have accessed your site to check it again. I can confirm that console error that my colleague Predrag mentioned but there are also other issues worth addressing.

    When you install Appointments+ plugin it automatically creates "Make an Appointment" page which is by default used for booking appointments. On your setup it is https://charterstthomas.com/make-an-appointment/ page. This page, however, cannot be used to book appointments via MarketPress.

    Furthermore, it is set in "Store Settings -> Presentation -> Store pages" as a "Product list" page. It shouldn't be set like that. The "Product list" page is a special page for MarketPress meant to display the list of products of your store. If it's set to "make an appointment" page, not only it won't list other products but it will not also work for booking appointments. I would suggest changing that.

    The second thing is that instead of https://charterstthomas.com/reserve-your-charter/ page you should be using a "product" to book appointments in order for it to work with MarketPress and let your customers access the cart. This page is currently https://charterstthomas.com/make-an-appointment/appointment/ page (though this URL will change if you sort out the first issue).

    When booking via this page, appointment should be added to cart an a link to checkout should be displayed after appointment confirmation. Then the booking goes to "Pending" appointments until a payment is made which serves as a confirmation (the booking goes to "Confirmed").

    This, however, doesn't work properly indeed and aforementioned error breaks it. The error is actually a HTML <p> </p> set of tags somehow injected into the JS script that's used by Appointments+ booking calendar. It only gets added there with this theme.

    That being said, I checked the theme and even though I couldn't even activate it on my setup (it broke the site), I tried to investigate the files and I found that the content of the post - and the product is actually a post of custom post type "product" - is displayed with this code inside WP loop:

    echo wpautop(do_shortcode(get_the_content()));

    This is rather non-standard approach but also simply wrong (probably it's a leftover from a an old version of the theme). What this code does is:

    - "get_the_content()" function is fetching post (in this case product) content
    - it's wrapped inside the "do_shortcode()" function so all shortcodes inside the content were executed
    - then it's also wrapped inside "wpautop()" function so finally all the duble line-breaks were replaced with paragraph tags (<p>...</p>:wink:.

    The appointments product page content does contain some JS with "double line-breaks" and that this is breaking it.

    This should be fixed by developers of the theme.

    As a quick work around I can suggest:

    - create the most basic child theme of your current theme (see here: https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/)

    - copy a single.php file from the current theme (parent theme) to it's child theme

    - edit that file and replace this line

    echo wpautop(do_shortcode(get_the_content()));

    with simply this

    the_content();

    That being said, if it breaks other parts of your site, rename the "single.php" file in your child theme to "single-product.php" to affect only product pages.

    If that still doesn't work, there is a chance that I missed some other occurrence of similar line in theme files and, I"m afraid developers of the theme (or changing the theme) would be a the "last resort" as this is not a bug in Appointments+ but very non-standard code in a theme that breaks the plugin.

    Best regard,
    Adam

  • Federico

    wmpudev team, thank you so much for the assistance so far!
    We've been trying to solve this issue to no avail so far. So far we've done the following:
    -Began using https://charterstthomas.com/make-an-appointment/ for testing as this was the page created by Appointments +
    -Created the Child theme and edited the single.php file as you advised.
    -In Store Settings > Presentation > Store Pages we changed Store base to: Destination Listing and Product List to Destination listing as well.

    Unfortunately none of these changes have gotten the forward to the cart page to work.

  • Predrag Dubajic

    Hi Federico,

    I've just checked your site and the booking seems to be working fine, please not that you need to use product page with a booking form in order to use MarketPress integration.
    I went to your https://charterstthomas.com/make-an-appointment/appointment/ page and from there I was able to book an appointment, and checkout link showed up so I could continue to payment from there.

    Can you check that page and confirm if it works for you as well?

    Best regards,
    Predrag

  • jetmac

    Team WPMU,

    The functionality of Appointments+ not lining up smoothly with MarketPress sounds like a defect to me. If Appointment+ makes a default "make an appointment" page, that should be the page. I doubt if users would natively realize that they can't use the page the plugin created.

    This should be fixed. When integrated with MarketPress for payments, the one of the plugins should recognize that and self-adjust.

  • Adam Czajczyk

    Hello jetmac

    I hope you're having a nice day and thank you for your feedback.

    When the Appointments+ is set without MarketPress integration, the "make an appointment" page is created. That's the default setup. However, when you decide to integrate it with MarketPress there's an option to make A+ automatically create a product page - it's basically up to the webmaster to e.g. put a link to that product page in the menu or anywhere else on the page. That's quite simple thing to do so I wouldn't consider that as a bug.

    Having that said, I do agree that it's not quite an "intuitive" scenario and I agree with you that it would be much better (and probably actually expected) if plugin's integration with MarketPress was automatically taking care of this. It's a reasonable assumption.

    That's why I have created an internal report (in our internal bug/issues ticketing system) for our developers about this so they could look into it.

    Kind regards,
    Adam

  • Predrag Dubajic

    Hi Federico,

    What Panos provided is not a standard plugin, it's actually a mu-plugin, sorry that was not clear and let me explain its usage further :slight_smile:

    When using mu-plugin you don't need to install it as a regular plugin or to activate it.
    What you would need to do is download the zip file from the above link, then on your computer unzip it and upload that unzipped file to /wp-content/mu-plugins/ folder via FTP or cPanel.
    If you don't have mu-plugins folder then simply create one yourself and place the file there.

    And that's it, once the file is in there the code will be fired up without any additional activation :slight_smile:

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.