Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter petrumuntiu

    (@petrumuntiu)

    Hello, It worked and now I am able to use the domain and tld as variables.
    I have used the URL attributes. First I created my custom link by using the Hook from your plugin

    function change_whois_result( $whois_result ) {
    
        if ( in_array( $whois_result['tld'], array( 'net','ro','eu','com','us','org','info','biz','es','de','uk','co.uk','in' ) ) ) {
            $whois_result['link'] = 'https://truesoft-d.com/product/domain-[tld]/?domain=[domain]&tld=[tld]';	
        }
        return $whois_result;
    }

    Then I have created an additionl fuction to store the variables

    function add_get_val() { 
        global $wp; 
        $wp->add_query_var('domain'); 
        $wp->add_query_var('tld'); 
    }
    add_action('init','add_get_val');

    And then I have used a shortcode fuction to read the values

    function WhoisDomainShortcode() {
    	return get_query_var('domain') .'.' . get_query_var('tld');
    }
    
    add_shortcode('wp24_result_domain', 'WhoisDomainShortcode'); 

    Many thanks for your advice.

    Thread Starter petrumuntiu

    (@petrumuntiu)

    Hello, unfortunately I didn’t received an answer to my question. Maybe my question was not clear enough, this is why I wiill try to explain it again.

    step 1. the user will use the search bar of the pluginn to see if the desired domain is available.
    step 2. the available domains wil be displayed by the pluggin with the price and the button “buy now for $10”
    step 3. the user will chose the desired available TLD and will click on the button, but it will not add the domain to cart in this step, actually it will redirect the user to the woocommerce product page where the user must fill-up some additional informations.
    step 4. then the user will click the “Add to cart” button on the woocommerce product page.

    Now my question is for step 3 when the user will be redirected to the product page:
    Is it possible to take the selected domain somehow in a global variable which will be then used into the custom function to display this domain as a shortcode? My function is in the previous message.

Viewing 2 replies - 1 through 2 (of 2 total)