• Resolved Iftikhar Alam

    (@iftikharalam)


    hey, I want to provide a demo link with the product, but I am not able to find that option.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Pratik Jain

    (@pratik-jain)

    Hi @iftikharalam

    Plugin does not have any feature to add “Demo Link”. Do you have any rough screenshot how you want? so may be I can help you.

    Right now, you can add it with product description so it will be displayed at product single page.

    Thread Starter Iftikhar Alam

    (@iftikharalam)

    I want the demo link button will appear on the middle https://prnt.sc/nkxqyk

    Pratik Jain

    (@pratik-jain)

    Hi @iftikharalam

    Thanks for the screenshot.

    I am not sure how you added the “Update” button. Can you tell me how you added the “Update” button.

    Can you please provide me the webpage link on which you have added the EDD product download button?

    Thread Starter Iftikhar Alam

    (@iftikharalam)

    Sorry, I can’t provide you the link of the website, but I have added the update button with Elementor. I want a dynamic demo button to

    Pratik Jain

    (@pratik-jain)

    Hi @iftikharalam

    OK.. You need to do some custom coding for this. You can do something like this

    1) Register a custom metabox “Demo Link” for EDD products ans save it’s value
    2) Now use EDD action to display custom “DEMO Link” after the EDD purchase button.

    Here is EDD action hooks https://docs.easydigitaldownloads.com/category/504-hooks

    If you are using purchase_link shortcode then this action edd_purchase_link_end will be helpful.

    Thread Starter Iftikhar Alam

    (@iftikharalam)

    can you please explain to me in a non-technical way. if you can create a tutorial for this that will be helpful

    Pratik Jain

    (@pratik-jain)

    Hi @iftikharalam

    No Problem. Give me some time I will try to create a sample code for this.

    Thread Starter Iftikhar Alam

    (@iftikharalam)

    Thank You, I am waiting

    Pratik Jain

    (@pratik-jain)

    Hi @iftikharalam

    Kindly add below code to your theme functions.php file.

    /**
     * Enables the Excerpt meta box in Page edit screen.
     */
    function _edd_add_post_type_support() {
    	add_post_type_support( 'download', 'custom-fields' );
    }
    add_action( 'init', '_edd_add_post_type_support' );
    
    /**
     * Display product demo link
     */
    function _edd_purchase_link_end( $download_id, $args ) {
    
    	$demo_link = get_post_meta( $download_id, 'edd_demo_link', true );
    
    	if( $demo_link ) {
    		echo '<a href="'.esc_url( $demo_link ).'" class="button blue" target="_blank">'.__('Demo Link').'</a>';
    	}
    }
    add_action( 'edd_purchase_link_end', '_edd_purchase_link_end', 10, 2 );

    Once you add code and save it then you can see “Custom Fields” metabox section at product add / edit screen. In that you need to add product demo link so meta name will be “edd_demo_link” and value will be your demo link. Please refer below screenshot
    https://screenshots.firefox.com/YFN4mxyfu9vqJiL9/192.168.1.53

    A demo URL button will be added to after EDD Product purchase button.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘demo link’ is closed to new replies.