Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to re-render UI incheckout page when cart items change ,and not refresh checkout page #2695

Open
HATECORO opened this issue Oct 11, 2024 · 8 comments

Comments

@HATECORO
Copy link

We want to add products to cart in checkout page ,but every time we need refresh checkout page to render new items.So we want to not refresh page ,just refresh right products content

@bc-peng
Copy link
Contributor

bc-peng commented Oct 13, 2024

I understand your question is about displaying newly added cart items without refreshing the page.

It seems you might be interested in updating the checkout state to reflect these changes.

Perhaps you could consider running the following function after modifying the cart:

checkoutService.loadCheckout(checkoutService.getState().data.getCheckout()?.id);

@HATECORO
Copy link
Author

I understand your question is about displaying newly added cart items without refreshing the page.

It seems you might be interested in updating the checkout state to reflect these changes.

Perhaps you could consider running the following function after modifying the cart:

checkoutService.loadCheckout(checkoutService.getState().data.getCheckout()?.id);

Thanks guys!
I did a test with your code but the checkout UI is missing and not updated.
http://localhost:3030/checkout
image
image

@bc-peng
Copy link
Contributor

bc-peng commented Oct 15, 2024

Are you using checkout-sdk's state?

@HATECORO
Copy link
Author

Are you using checkout-sdk's state?

image
This is my code.

@HATECORO
Copy link
Author

Are you using checkout-sdk's state?

I ran the code in the console, but the checkout page was not updated after running, but the subscript was triggered.

@bc-peng
Copy link
Contributor

bc-peng commented Oct 15, 2024

Just to clarify, maybe your situation is that you're using native checkout-js and would like it to display newly added items without a page refresh.

If that's the case, our upcoming checkout-extension system would allow this functionality within native checkout-js. Currently, there isn't a way to achieve that without a page refresh.

@bc-peng
Copy link
Contributor

bc-peng commented Oct 15, 2024

The native checkout-js is this, https://github.com/bigcommerce/checkout-js.

Right now, you're looking at checkout-sdk-js that supports checkout-js or building your own custom checkout.

@HATECORO
Copy link
Author

Just to clarify, maybe your situation is that you're using native checkout-js and would like it to display newly added items without a page refresh.

If that's the case, our upcoming checkout-extension system would allow this functionality within native checkout-js. Currently, there isn't a way to achieve that without a page refresh.

I see,some extention use reload function to reload.So if there have a document for checkout-extension, I have not saw it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants