There could be two different ways to acheive what you are expecting. When the bar got stuck, the class of x-bar-fixed is being added to it. So you can add the following custom CSS code into the specific Bar to show the Cart only if the class x-bar-fixed is added into it.
Please remember that the above code will work if copied as it is and doesn’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something on your site nor will we enhance it.
Another way is you can add two different Bar and add Cart elements into the initially hidden Bar. To create a similar setup, I would suggest you go through the following thread.