• Resolved petrumuntiu


    Hello and thanks for the great plugin.
    I am using it but my website is still in development (not yet finished).
    In my case after let’s say the user will use the search for available names, the user will select then the domain if it is available (I am using button instead of link) and it will click the button “buy now for $10” and it will redirect to the WooCommerce product page.
    I have created a shortcode funcion in my child theme to be displayed in the product page:

    add_shortcode(‘wp24_result_domain’, ‘DomainCheckShortcode’);
    function DomainCheckShortcode() {
    global $test_domain;
    return $test_domain;

    Is it somehow possible to display here on the product page the domain name that the user has choosen using my shortcode?

    • This topic was modified 1 year, 7 months ago by petrumuntiu.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP24


    The domain name is stored within the cart item. So you would have to loop through the cart items and find the corresponding product to get the domain name.
    Something like this (content-single-product.php):

    foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
      if ( $cart_item['product_id'] == get_the_ID() )
        echo $cart_item['wp24_domain'];
    Thread Starter 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.

    • This reply was modified 1 year, 7 months ago by petrumuntiu.
    • This reply was modified 1 year, 7 months ago by petrumuntiu.
    • This reply was modified 1 year, 7 months ago by petrumuntiu.
    Plugin Author WP24


    I’am afraid that this would not work with the WooCommerce integration of the plugin.
    An idea could be to use the Prices & Links and create a custom page to which you pass the domain and then store it in a global variable. For example https://yourdomain.com/savedomain.php?domain=\[domain\].\[tld\]. Inside the savedomain.php you read the domainname from the URL and save it into a global variable. Then you redirect to the product page.

    Thread Starter 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; 

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display available chosen domain name in the WooCommerce Product page’ is closed to new replies.