Forum

Thread tagged as: Question, Members, Shop

Shop Checkout Addresses

I'm having great difficulty working out how to get addresses to work nicely with checkout. I've tried using the nest demo as an example, but even with it I can place an order and no shipping or billing address details are asked for?

A customer simply registers as a member, logs in and places an order and at no stage are they asked for an address!? So an admin would come along and not know where to ship an item!!

The managing address examples seem to have lots of duplicate addresses which is really messy.

Ideally, I think a simple one page checkout with a pre-populated billing/shipping address and shipping method would be very beneficial. Any direction?

Brad Hardinge

Brad Hardinge 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

That should be possible (it's what I do for my course sales) but we would need to see your code to see what problem you are having as it really is up to you how you set it up.

The best approach is to decide what you want for your store, then look at using the functions to do that. We wanted to avoid making this a "shop in a box" and restricting people to a very few options. However that does mean you need to do the step of designing that process first.

Thanks, think I'm slowly getting closer to something that might work.

Initial orders work fine as the addresses from the registration processes save and perch_shop_addresses_set is true. If a user comes back to order again though, perch_shop_addresses_set is not true and perch_shop_order_address_form is displayed. Is there a way to programmatically set the addresses? (Billing to 'default' and Shipping to 'shipping')

if (perch_shop_addresses_set()) {
    perch_shop_order_addresses();
} else {
    perch_shop_order_address_form();
}
Drew McLellan

Drew McLellan 2638 points
Perch Support

The idea at that point is that you can display the address options and enable the customer to pick an existing address, edit the address or specify a new one.

Understood, the address picker is displaying and works, I would just prefer it not to and to automatically pick the addresses that were used last time. If I could programmatically set the address to the addresses with id's 'default' and 'shipping' that would would be ideal.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you verified that that doesn't actually happen? I think it might well.

No, it doesn't. When you try to reorder perch_shop_addresses_set is false.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right, but what happens then? I think if you more forward the defaults are used.

If I don't check for perch_shop_addresses_set and try to move forward and place the order, perch_shop_order_successful is false on the results page. The only difference I can see in the CMS backend is there is no BILL_ADDRESS or SHIP_ADDRESS in the Tax Evidence tab for the order.

I tried another approach using perch_shop_customer_edit_form instead of perch_shop_order_address_form which is pre-populated and allows the customer to change address details but when update is hit perch_shop_addresses_set is still false!

And when perch_shop_addresses_set is false, perch_shop_order_addresses displays nothing and I need it to display the addresses for the customer to confirm and place their order.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I'm not sure I understand what's going on. Does the customer have an address, even if it's not been set?

Ok, I'll see if I can define what's happening and what I'd like...

When a new customer goes through the cart and gets to the checkout, they get to the following code:

if (perch_shop_addresses_set()) {
    perch_shop_order_addresses();
} else {
    perch_shop_order_address_form();
}

perch_shop_addresses_set is true as they've just filled in the new customer register form and perch_shop_order_addresses displays the addresses with edit buttons for the customer to see before clicking "Pay". This all works great!

The issue is returning customers. When they log in or are already logged in and try to place another order, when they get through to the same part of checkout, perch_shop_addresses_set is false and perch_shop_order_address_form displays 2 lists of addresses.

I don't want to display these ugly lists. I either want to programmatically set perch_shop_addresses_set true (using the defaults) so perch_shop_order_addresses displays or display perch_shop_customer_edit_form and when this form is submitted have perch_shop_addresses_set set to true (which it does not).

It seems the only way to get perch_shop_addresses_set true is to submit the perch_shop_order_address_form?