Forum

Thread tagged as: Question, Shop

Is there a way to change a shipping address once registered in the Shop app?

I'm doing a hidden registration for the shop app but which allows the user to put in separate billing and shipping addresses.

I'd like to offer the customer the chance to change the address at the confirmation stage before they go off to the payment gateway.

I made an edit page that uses perch_shop_edit_address_form();

However, I can only get the billing address to populate the address form - perch:showall only offers the 'default' addressID, which is billing in this case. Is there a way of getting the shipping addressID? Or do I just assume that the shipping address is always one ID digit higher and do some php arithmetic?

Is there a Perch way to get the addressID for the logged in customer?

Robert Sinclair

Robert Sinclair 4 points

  • 4 years ago

Okay, don't worry. I thought there might be a shorter way to get the addressIDs but I'm just using a URL query and perch_get to sort the billing and then as thought adding 1 to the default addressID to get the shipping addressID.

You should never assume id's will be sequential. Should another customer happen to be at the same stage where something is being entered into the database as another the id's may not follow the scheme you're anticipating. Since the tables are not "locked" during the transaction it it possible (2) processes could be written at the same time to the same tables.

I hope I am making sense here.

Okay, good point Robert. Thank you.

So my question goes back to what is the best way to get that shipping address?

Oh, I see. Rather than try and do both addresses at the same time, I can list them out for a given customer with an edit button on each that carries the specific addressID.

Robert Sinclair said:

Oh, I see. Rather than try and do both addresses at the same time, I can list them out for a given customer with an edit button on each that carries the specific addressID.

This sounds like a perfect solution.