• Resolved jaykalter

    (@jaykalter)


    Hello all,

    New to this forum and also new to coding, so please bear with me since it’S probably a simple answer to my question!

    I have the below code which pops up a window for user ratings at order confirmation. The pop up window comes up fine but the values are not being populated.

    The values I need are: email, order number and date the order was placed (no time needed, just the date format in YYYY-MM-DD.

    When I echo the values they are correct. Only the date for some reason is not being populated, that is my first issue.

    If I hard code the values when assigning the Div Id values it works fine but it does not pull the data correctly on it’s own. i.e. <div id=”rating_ordermail”>[email protected]()</div>

    Any help would be appreciated.

    Here is the code I found on the internet and have tried various combinations but failed!

    add_action( ‘woocommerce_order_details_after_order_table’, ‘trusted_shops_thankyou’, 15, 1 );
    function trusted_shops_thankyou( $order ) {

    echo $order->get_billing_email();
    echo $order->get_order_number();
    echo $order->get_date_completed();

    // I need to fill the following DIVs
    echo ‘
    <div id=”ratingvalues” style=”display: none;”>
    <div id=”rating_ordermail”>echo $order->get_billing_email()</div>
    <div id=”rating_ordernumber”>echo $order->get_order_number()</div>
    <div id=”rating_orderdate”>echo $order->get_date_completed()</div>
    </div>
    ‘;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @jaykalter

    This is a fairly complex development topic – it could be there is some missing code since you’re using trusted_shops – did you copy and paste this from somewhere?

    I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Customizations: https://woocommerce.com/customizations/
    2. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    3. WooCommerce FB group: https://www.facebook.com/groups/advanced.woocommerce/

    Thanks,

    Thread Starter jaykalter

    (@jaykalter)

    Hi dougaitken,

    Thanks for your reply.

    Yes this code was given to my by trusted shop. It’s a German company and my German is not the best so that’s why I ask here for help first since I thought it could be a simple solution.

    The original code I was given is below. They said I just need to fill in the parameters from the customer, i.e. email, order id and date of order.

    Thanks.

    <div id=”ratingvalues” style=”display:none”>
    <div id=”rating_ordermail”>[email protected]</div>
    <div id=”rating_ordernumber”>01-Die-Bestellnummer</div>
    <div id=”rating_orderdate”>2017-03-14</div>
    </div>

    laceyrod

    (@laceyrod)

    Automattic Happiness Engineer

    Howdy,

    This thread has been inactive for a bit, so I’m going to close it out. Since this is a more development-oriented question, I would still recommend reaching out to the following services that my colleague mentioned for help.

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Assign DIV ID a value.’ is closed to new replies.