BigCommerce Add Products To Cart API - api

I'm just setting up my first BigCommerce store, and I'd like to know if I can use their API to add products to a shopper's cart and forward them to the checkout page programmatically?
The problem I'm trying to solve is creation of bundles of products in the store. I need to have each product in a bundle show up as a separate line item and sku on the order, but BigCommerce does not natively support this. The next best thing I can think of is to send the user to a specially crafted php page that will add the constituent parts to their cart, then forward them to the checkout page.
Am I barking up the wrong tree? Is there a simple way to do this that I've missed?

You can use the Cart api to
- Create cart
https://developer.bigcommerce.com/api/v3/cart.html#post-carts
and use the created cart id to
Generate cart URL
https://developer.bigcommerce.com/api/v3/cart.html#post-carts-cartid-redirect_urls
Then you can move the user to this url

Related

How i can add a button on the cart page that will allow the customer to "Empty The Cart". In bigcommerce

How i can add a button on the cart page that will allow the customer to "Empty The Cart". Script will empty contents of the cart.
you could create the button in the template and use a script to call this endpoint: DeleteACart https://developer.bigcommerce.com/api-reference/store-management/carts/cart/deleteacart, to erase an entire cart.
You don't want to use the management api to do this, because that would require authentication. You need to use the storefront cart api I believe.
You would need to call GET /api/storefront/carts and get the id of the cart, and then call DELETE /api/storefront/delete/{id}.
Alternatively you could mimic the native functionality by looping through all the cart items to build a request for POST /remote/v1/cart/update.
The template file for cart in cornerstone is templates/pages/cart.html

Shopify: Pass values from non-Shopify site to Shopify Checkout and get URL

I have a static (non-Shopify) HTML and JS website with a shopping cart where its functionality is carried out using JS and Jquery. I need to pass my cart values to Shopify and take the user directly to the Shopify Checkout page when user clicks on the checkout button on my site. I need to pass cart values to Shopify and load the checkout page on the browser. How can I do this? I'm new to Shopify and I need some guidance on how to do this.
If you have access to variant ids and quantities in the cart, you can use a permalinks for this purpose. Example - http://yourstore.com/cart/70881412:1,70881382:1
More details here - https://community.shopify.com/c/Shopify-Design/Cart-Use-permalinks-to-pre-load-the-cart/td-p/613702

Remove all cart items on log out in stencil bigcommerce

Is there any way to remove all cart items when the user logout? I tried getting all the item ID and looping over it and calling the utils cart remove API on every iteration, but it seems it only remove the first one. Any idea about this?
Instead of looping over each item, I'd recommend calling the storefront cart API delete cart endpoint.
Removing all cart items essentially deletes the cart, so the cart winds up in the same state either way. Here's a link to a tutorial on working with the storefront cart API that might help.

Shopify - Product filter with parameter

I am looking for custom product filter using my custom Shopify App. I have created an app like structure and which is append to the product collection template.
How can I pass custom parameters like price, category or product attributes via URL or how it will render the product on the collection page.
Thanks,
Navas
If you created an App, you can add a Proxy to it. The Proxy allows Shopify to send secure data to your App via a Javascript call. You get the data from the shop about the product, you filter it, and you return JSON data if you want, to help the front end. Works great. Try it.

What should be the URL for Products page which is independent of Product Categories- Big Commerce?

I am customizing my Big commerce Store... I need a products page which is independent of product categories.
I am trying the below URL for products page but it says "Page cannot be found".
%%GLOBAL_ShopPathNormal%%/products.
I need the URL to redirect to product page. Please help.
%%GLOBAL_ShopPathNormal%% gives you the store url (non SSL version). The navigation is category based. What you are trying will not work. Maybe, you can hack this - Create a category called "products" and add all the products to it. Then, when you navigate to the URL (storeurl/products), it should list all the products.