• Resolved rashidavc18

    (@rashidavc18)


    Hi,

    I am using this with wcfm
    The pdf is link not attached after payment in checkout page.is this feature available with this plugin.Please let me know

    • This topic was modified 8 months, 2 weeks ago by rashidavc18.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Thread Starter rashidavc18

    (@rashidavc18)

    Thank you so much
    But please let me know how to show the download link in thank you page only after payment is made.I am having a pre order facilty where payment is done later.So the the download link should only be shown after payment process is completed.
    Thank you

    Plugin Contributor dwpriv

    (@dwpriv)

    @rashidavc18 you can try this snippet

    add_filter('woocommerce_thankyou_order_received_text', 'wpo_wcpdf_thank_you_link', 10, 2);
    function wpo_wcpdf_thank_you_link( $text, $order ) {
    if ( is_user_logged_in() && $order->is_paid() ) {
    $pdf_url = wp_nonce_url( add_query_arg( array(
    'action' => 'generate_wpo_wcpdf',
    'document_type' => 'invoice',
    'order_ids' => $order->get_id(),
    'my-account' => true,
    ), admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' );
    $link_text = 'Download a printable invoice / payment confirmation (PDF format)';
    $text .= sprintf( '<p><a href="%s">%s</a></p>', esc_attr( $pdf_url ), esc_html( $link_text ) );
    }
    return $text;
    }
    Thread Starter rashidavc18

    (@rashidavc18)

    Thank you so much.
    With this case the download link is shown initially when order is made without payment in the checkout page .But when the checkout page is reloaded the link is not shown(desired functionality).
    Can you please let me know why the link is shown initially when an order placed without payment.

    Plugin Contributor dwpriv

    (@dwpriv)

    @rashidavc18 I’m not quite understanding. There’s only one thank you page that loads after payment is made, and the page doesn’t auto reload. Is there another page in your checkout process? Could you share a screenshot of the initial page and the reloaded one, please?

    Thread Starter rashidavc18

    (@rashidavc18)

    Sorry for the confusion,

    The thank you page is not auto reloaded.It is found that payment status is not updated initially when order is made without payment.And hence the pdf link is shown even if payment is not made.when reloading the page again (manually) the pdf link is removed for this unpaid order

    Hope i was able to convey the issue.
    Thank you

    Plugin Contributor dwpriv

    (@dwpriv)

    Try this one @rashidavc18

    add_filter('woocommerce_thankyou_order_received_text', 'wpo_wcpdf_thank_you_link', 10, 2);
    function wpo_wcpdf_thank_you_link( $text, $order ) {
    if ( is_user_logged_in() && ! empty( $order->get_meta( '_paid_date' ) ) ) {
    $pdf_url = wp_nonce_url( add_query_arg( array(
    'action' => 'generate_wpo_wcpdf',
    'document_type' => 'invoice',
    'order_ids' => $order->get_id(),
    'my-account' => true,
    ), admin_url( 'admin-ajax.php' ) ), 'generate_wpo_wcpdf' );
    $link_text = 'Download a printable invoice / payment confirmation (PDF format)';
    $text .= sprintf( '<p><a href="%s">%s</a></p>', esc_attr( $pdf_url ), esc_html( $link_text ) );
    }
    return $text;
    }
    Thread Starter rashidavc18

    (@rashidavc18)

    Unfortunately the pdf link is not loaded.
    Is there any other option. Please let me know

    Thank you

    Plugin Contributor dwpriv

    (@dwpriv)

    It’s likely because the check for the paid status wasn’t successful. Is there a particular meta that is set on your site when the order is confirmed paid at checkout? You can use the guide here to find the meta key.

    Plugin Contributor dwpriv

    (@dwpriv)

    Since we haven’t heard back from you, we will mark this topic as resolved and close it. Feel free to reopen it if you need further help or open a new thread if you need help with something else.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Invoice PDF link after payment in checkout page’ is closed to new replies.