Posts by proctor

    Thanks hus_hmd! Yes, the case with perch_shop_order_successful() is exactly as you said. I will have a look at the custom solution you suggested. I also found out that a way to avoid recording duplicate purchase events is passing a transaction ID to the request. Then the receiving service should have a way to ignore duplicates. Google analytics does it but not sure about the marketing tool I plan to use. Some more investigation for me. Thank you again.

    Hello. I am trying to integrate a marketing automation tool to a Runway site and looking for the best place to put the POST request to their API to record a purchase. I'm a frontend person understanding PHP but not too familiar!

    My first thought was to put it right in the payment success page but I don't think this is the best option since this page is a regular page accessible from anywhere and could potentially trigger more requests than purchases. I thought I could somehow block access to this page unless user is coming from checkout but I don't know how to do it :(

    Next thought was to put it in the checkout page where there is the following piece of code (I'm using Braintree by the way)

    1.  if (perch_member_logged_in() && perch_post('payment_method_nonce')) {
    2. // your 'success' return URL
    3. $return_url = '/paymentsuccess';
    4. perch_shop_checkout('braintree', [
    5. 'return_url' => $return_url,
    6. 'token' => perch_post('payment_method_nonce')
    7. ]);
    8. }

    My understanding is that this perch_shop_checkout is what actually performs the checkout so I could maybe put the POST right before it. Do you think this is how it should be done? And if so, what is the PHP equivalent to javascript Promises where I could do the something like postTrackingData().then(perch_shop_checkout)

    Thank you very much for any advice!

    Hello, I am facing a weird issue in a page that contains both perch_shop_customer_edit_form and perch_shop_customer_addresses.

    Whenever I visit this page there are 2 or 4 more empty addresses printed by the second function. For the edit form I tried with the default template thinking I could be doing something wrong but made no difference. I'm pretty sure it is these two functions that give the issue because when I remove the form, the addresses don't increase any more in every visit.

    I would really appreciate any ideas here!!

    This is the debug I'm getting in case it helps.