• Resolved vahid2451

    (@vahid2451)


    I have a downloadable product on my site
    But instead of a file, I want to put the URL of one of my site pages in the download section so that when the buyer clicks on the download link, that page is displayed to them

    I also checked the Open in browser option
    also enabled the Redirect only option

    Now when I put the link to the page, an error appears and the link does not work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello vahid2451,

    Thank you for contacting WooCommerce support.

    I understand you want to use a URL of one of your site pages as the download link for your product, but you are encountering an error, and the link does not work.

    The “Redirect only” option is intended for redirecting file URLs, not for linking to internal site pages.
    The downloadable products feature does not provide an option to redirect users to another URL after a product is purchased.

    I suggest you look for a membership solution where you can redirect users to specific URLs after they purchase a membership.

    Let me know what you think.

    Best regards.

    Thread Starter vahid2451

    (@vahid2451)

    I used another method to solve this problem
    I defined a custom field and the site administrator enters the URL of the suspicious page in that field on each product page
    Then, I put a code in the theme function to display this custom field on the order page:

    add_action (‘woocommerce_order_details_after_order_table’, ‘action_order_details_after_order_table’, 20 );

    function action_order_details_after_order_table($order) {
    foreach ( $order->get_items() as $item ) {
    if ( $info_complementar = get_field(‘bklnk’, $item->get_product_id())) {

    echo "<a class='vmbklnk' href='$info_complementar'>view" ;
    echo wp_kses_post( apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item->get_name() ) : $item->get_name(), $item, $is_visible ) );

    echo "</a>" ;

    }
    }

    }

    Plugin Support Moses M. (woo-hc)

    (@mosesmedh)

    Hi @vahid2451,

    I’m glad you were able to get it done using a custom field and thank you for sharing the procedure here as it can help others in the future.

    Kudos.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.