There is no built in solutions if i want to sell only 1 product on my shop, without specifying the quantity and passing the cart form, right to the checkout .
So right now u need to specify the exact quantity in product details form.


I simply added an variable IsOneProduct to each of required class( 15 mins of work ...)
And edited Addtocart.cshtml


<div class="add-to-cart-panel">
@if (!Model.IsOneProduct)
{
<input asp-for="EnteredQuantity" class="qty-input" type="text"/>
}


So it get to this



very simple, and yes u could specify the product maximum quantity to 1, but that wouldn't solve the problem and only will annoy you with red banner

So to actually pass the cart form we need to modify few things



1.Modify AjaxCart.addproducttocart_details in Ajax.js , so the customer get redirected right after product is added to cart


    redirectcheckout: '', // to the header of the class
addproducttocart_catalog: function (urladd,redirect) {

        if (redirect != undefined) {
            redirectcheckout = redirect;
        }

success_process: function (response) {

  if (response.success == true) {
                //success
                if (redirectcheckout != undefined) {
                    location.href = redirectcheckout;
                    return true;
                }
}
}
}

2.Adding simple function to redirect url in AjaxCart.js if customer has already added the product to the cart
// it might be needed to modify the checkout form, so it would be applied only per selected product, but not all of them, or add that info in checkout form.
 addproducttocart_redirect: function (urladd) {
        if (this.loadWaiting != false) {
            return;
        }

        this.setLoadWaiting(true);

        if (urladd != undefined)
            location.href = urladd;
        else
            return;
    },

3.Make sure that product isn't in the cart
Inside Addtocart.cshtml
    @using Nop.Core
    @inject IWorkContext workContext
if (!workContext.CurrentCustomer.HasShoppingCartItems)
{
//we are passing '@Url.RouteUrl("Checkout")' to the modified addproducttocart_details
                            <input type="button" id="[email protected]" class="button-1 add-to-cart-button" value="@addToCartText" data-productid="@Model.ProductId" onclick="AjaxCart.addproducttocart_details('@Url.RouteUrl("AddProductToCart-Details", new {productId = Model.ProductId, shoppingCartTypeId = (int) ShoppingCartType.ShoppingCart})', '#product-details-form','@Url.RouteUrl("Checkout")');return false;" />

}
else
{
//if product is already added we just redirect to the checkout page // need to make sure that checkout model handles only current/selected product , or add additional info on those that were added.
                            <input type="button" id="[email protected]" class="button-1 add-to-cart-button" value="@addToCartText" data-productid="@Model.ProductId" onclick="AjaxCart.addproducttocart_redirect('@Url.RouteUrl("Checkout")');" />

}
Also we can cover all of that with simple check
[code]  if (!Model.IsOneProduct)
{

}

So this option would be applied only on products that we specify from admin menu

And we get this result - when customer press the buy/add to cart button( it could be already altered to checkout), single product checkout



I encountered few problems with defaultResources.nopres.xml ,i added necessary data there, but it didn't affected on admin panel menu, seems that it was written somewhere in database or memory, or smthng else.
Also i'm not sure about adding the variable to StandardPermissionProvider , as there is no visual control of those variables , so maybe its enough to set PrepareGroupedProductOverviewPriceModel to false instead of adding that var.

And one more thing, i did it all manually even if cost me not that much time, maybe there is some automatic macro solution(like the one intelisense provide) but with adding to all necessary classes ? its just a getter/setter .


All code is included here https://pastebin.com/z3mtNdVf
with xml js sql .

I hope i didn't forgot anything, feel free to comment if anything that i writed is wrong, im C++ coder mostly, not web =) .



I leave it here just so if i lose sources i could back it up from here, it happen to me one time =))