Home › Forums › WoodMart support forum › How to make stick add to cart button as back to top
How to make stick add to cart button as back to top
- This topic has 5 replies, 3 voices, and was last updated 8 months, 3 weeks ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
December 7, 2024 at 6:46 pm #620447
manhtenParticipantHello,
I’m using the **Sticky Add to Cart** feature on both mobile and desktop. How can I make it so that when the sticky Add to Cart button is clicked (on either mobile or desktop), the page scrolls up to the top or to the main Add to Cart button on the product information page before proceeding to checkout? This is because my website has several options that customers need to see before moving to the checkout page.I only need the sticky Add to Cart button to scroll to the top or to the main Add to Cart button (similar to the “Select Options” button functionality).
ThanksDecember 9, 2024 at 11:53 am #620707
Aizaz Imtiaz AwanKeymasterHello,
Sorry but there is no option in Theme Settings available for that.
It requires customizations and this is beyond our limitations and support policy.
Regards.
Xtemos StudiosMarch 10, 2025 at 9:21 am #644317
itayitachParticipantHey manhten.
Did you manage to do that?
If so…can you share with me how?March 10, 2025 at 2:01 pm #644469
manhtenParticipantYes. You can add this JS to custom JS. (ChatGPT. :D)
`document.addEventListener(“DOMContentLoaded”, function () {
// Kiểm tra sự tồn tại của phần tử .wd-sticky-btn .wd-sticky-btn-cart
const stickyButton = document.querySelector(“.wd-sticky-btn .wd-sticky-btn-cart”);
const targetElement = document.querySelector(“.single_add_to_cart_button”);if (stickyButton && targetElement) {
// Gắn sự kiện click cho phần tử
stickyButton.addEventListener(“click”, function (e) {
e.preventDefault(); // Ngăn hành động mặc định
// Scroll tới phần tử .single_add_to_cart_button
targetElement.scrollIntoView({ behavior: “smooth”, block: “center” });
});
}
});March 10, 2025 at 3:33 pm #644510
itayitachParticipantThank you very much. I will try.
March 11, 2025 at 10:06 am #644678
Aizaz Imtiaz AwanKeymaster -
AuthorPosts
Tagged: add to cart
- You must be logged in to create new topics. Login / Register
