Adding CONTACT FORM SECTION to ORDER STATUS PAGE, but its not working properly.

AI-generated summary

カスタムの問い合わせフォームを ORDER STATUS PAGE(注文状況ページ)に追加したところ、送信自体とメール配信は正常に動作している一方、送信後の遷移先が /?contact_posted=true になり、トップページへリダイレクトされる点が問題になっている。希望は、送信後に元の注文状況ページへ戻すこと。

提案された対応は、form.posted_successfully? のような成功判定後に JavaScript で任意の URL へ window.location する方法。ただしこれは固定ページへの遷移には使えても、「どの注文状況ページから送信されたか」を判別して元のページへ戻す解決にはなっていない。

現時点では、フォームオブジェクトや URL から送信元の注文状況ページを特定できる情報が見当たらない、という認識。代替案として cookie やブラウザ保存領域に注文状況ページ URL や注文 ID を保持する方法が挙がっているが、信頼性に不安がある。結論は未解決で、非 Shopify Plus 環境での実現方法が引き続き不明。

Hi there.

On the ORDER STATUS PAGE, I have created a simple contact form section where the customer can immediately contact us about the order.

additonal script section in checkout setting, code as below


This section appear on the order status page and will be delivered as an email when you enter your inquiry.

So far, so good as I expected.

However, after clicking the submit button, browser is redirected to the top page as URL ‘/?contact_posted=true’.

It’s better to go back to the ORDER STATUS PAGE.

It’d be nice if there was a parameter to specify the return destination URL.

My plan is NOT Shopify PLUS.

Can you help, please.

Hi @Kanakano

You can try add this snippet:
{% if form.posted_successfully? %}

{% endif %}

Hey @LitExtension ,

Thank you your replying.

Sorry for the delayed response. (I missed a notification mail. xD)

I guess it means that if I put that snippet in the destination (top page) after posting a message, I can indeed move it to any page I want (maybe the “thank you for posting” page), but I want to move it back to the order status page.

There is no clue in the form object or the URL to know “from which order status page the message was sent”. (If there is such a thing and I just don’t know about it, please let me know)

There is a way to set the URL of the order status page and the order ID in the browser’s DB or cookie before sending a message, but I don’t think it is reliable. (If there is no other way, I’ll try it.)

regards