How to Use PHP Code In-Page?

There is almost never a scenario where executing PHP code entered from the wysiwyg editor is a good idea. It opens up a whole bunch of security issues.

The best way to achieve what you are looking for is to setup a custom short code that will return the link you are interested in. Add something like this to your functions.php file in your theme.

    function wpsc_my_special_cart_link(){
        return "https://diginomics.com/insider/?add-to-cart=" . get_the_ID();
    }
    add_shortcode('my_special_cart_link', 'wpsc_my_special_cart_link');

Now, anywhere in your post you want that url to appear you can simply type [my_special_cart_link] and your php code will be executed and the string that the function returns will be displayed.

I’d recommend modifying this function so that it is able to do the whole thing for you. i.e. rather than just returning the url, have it return the whole button, something like

function wpsc_my_special_cart_link(){
    $url = "https://diginomics.com/insider/?add-to-cart=" . get_the_ID();
    return '<a class="button" href="' . $url . '">My Link Text</a>';
}
add_shortcode('my_special_cart_link', 'wpsc_my_special_cart_link');

One other thing to note, if you are linking to another page within your site, it is considered better practice to use home_url('path/to/subpage') rather than manually typing out the url for your site. In that scenario, the code would look like this:

    function wpsc_my_special_cart_link(){
        return home_url("insider/?add-to-cart=" . get_the_ID());
    }
    add_shortcode('my_special_cart_link', 'wpsc_my_special_cart_link');