Reputation:
We want to achieve Quick Buy Functionality in Big-commerce Store. This functionality, we want to achieve on the results of quick search.
Please find attached screenshot for the reference. Customer can quickly add to cart the products with quantity while quick search and finally can checkout from the quick search window itself.
Please refer attached screenshot.
Can anyone help, what changes need to be done in template files to achieve this functionality?
Upvotes: 0
Views: 411
Reputation: 778
BigCommerce Stencil
You can add items to the cart from any page in your store via the AJAX API seen here.
// add item to cart
utils.api.cart.itemAdd(productId, quantity, options, (err, response) => {
let options = {
template: 'cart/preview',
params: {
suggest: response.data.cart_item.id
},
config: {
cart: {
suggestions: {
limit: 4
}
}
}
};
}
BigCommerce Blueprint
In blueprint, it's even easier. Just hit this URL with the products ID.
http://www.STOREURL.com/cart.php?action=add&product_id=PRODUCTID
Or for products with variations.
http://www.STOREURL.com/cart.php?action=add&product_id=PRODUCTID&variation_id=VARIATIONID
Not sure how you'd get the variation IDs in the quicksearch tab, but this is a good start. Also, checkout the quicksearch.js file in the js directory.
Upvotes: 1