Forum

Thread tagged as: Shop

Shop Checkout Advice

Hi guys,

Not so much a bug but just a bit of advice on the best way for the checkout process.

Currently my workflow is that you view your cart, then once you hit checkout you get to a page to login / register. However if already logged in then you bypass this page.

So this is where I am getting a bit muddled up. My thinking here would be that you get to a review page where you review your order before heading off to Paypal to complete payment. However am I missing a step where the user should be choosing / confirming their addresses?

This is my first shop so just getting a bit confused currently.

Thanks, Martin

Martin Murphy

Martin Murphy 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

It's really up to you what steps you want to include. I would design the flow you want and then implement it, we don't dictate any of this (or advise on what is best as that depends on the store you are building).

What would be the best way to use the billing address for the shipping address, to avoid having to add the address multiple times when registering?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you only specify a billing address then it'll be used for the shipping address too.

I have a form for updating an address so when the page is /cart/review?addressId=15 it displays the update form.

When I hit submit I am using <perch:input type="hidden" id="r" value="cart/review" />

However my issue is that it's keeping hold of the query string and adding a file extension. Is there anyway to strip the query string and file extension to land directly on /cart/review rather than /cart/review.php?addressId=15?

Thanks :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

What have you set the form action to?

Eugh, as soon as you said mentioned action I realised what I had done :(

Added an action on the form rather than the redirect on the input and it works perfectly now..

Thanks Drew!

Sorry me again, what's the best way to restrict people entering the checkout process, or even adding products to cart if they aren't located in the UK.

I have added the UK as my shipping method and made it the default, but I think people can still access the shop etc.

Thanks :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you wanting them to declare that they're in the UK, or somehow detect it?

Is there a perch function that would detect it based on ip or different detection (used ip before with Drupal)?

Currently only officially shipping to UK addresses so it would make more sense for us to just stop shop functionality if we can detect that they are outside the UK.

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not in Perch, but PHP has that natively.

Hi Drew, I have managed to set a session variable with the countrycode so essentially I am able to say if countrycode is GB.

Is there anyway I can use this functionality withing the perch templates? So currently where I have an add to cart button, swap it out for a message? Not sure if I can do this or not.

Setting a variable would probably achieve what you are after:

https://docs.grabaperch.com/templates/passing-variables-into-templates/

Is there any known way to build in a postcode lookup into the perch shop templates when adding an address form? Would this require passing information into the template?

Drew McLellan

Drew McLellan 2638 points
Perch Support

What sort of lookup service are you using? I guess how that works would be a big part of the answer.

I was looking at using https://getaddress.io/ - Just unsure whether or not I can deal with sending and getting a response from within the template file itself or whether this requires a bit more than that.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, let us know when you've figured out what the requirements of that service are.

Ah sorry Drew, turned out that I didn't actually need to pass anything through in the end. Just adding the field in and calling some jquery on it seems to work nicely.

Although having added some new address fields with new ids. The registration form doesn't seem to be collecting the address properly now. Do I need to do something else to use new address fields? It seems to work fine when I edit an existing address and use the new fields however trying to create a new address doesn't seem to work :(

Drew McLellan

Drew McLellan 2638 points
Perch Support

Was it working before?

Yes it was working fine before :/ and it also still works fine if I switch in the default template. So all I can see different is the input id's.

Just a side question as well - Is there a function that deletes an address?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you changing the field IDs?

You can't delete an address, only edit it.