Need a link in Shopify that adds items to cart and redirects to checkout - shopify

I am attempting to add a "quick purchase" option for my products in Shopify. I'd like to have one link that adds qty:1 for a specific product ID and then redirects the user to check out.
Is it possible to create a query string that will accomplish this?

Shopify has an inbuilt AJAX functionality for the purpose. Refer to the link: Shopify's Ajax API

Related

Passing data to shopify product/cart from a custom page

I have made this page https://tns.webwars.eu. This is a form that creates a skymap in away by filling the fields and then posts the data to https://the-night-sky.com/cart. I am using the cart.attributes feature at the moment but this applies for the whole cart and I want individual data for each item. Eg. If someone tries to add another map with different information.
Is there another way to pass the field values to the cart and therefore to checkout and confirmation email?
Thank you in advance
You should use Line Item Properties as described in good detail here: https://help.shopify.com/en/themes/customization/products/features/get-customization-information-for-products
That technique is per product, works perfect with the cart, checkout and admin, and is much easier to maintain than cart attributes.
You can use Shopify's Ajax API for that purpose:
https://help.shopify.com/en/themes/development/getting-started/using-ajax-api
Shopify provides shop-owners with an Ajax API that returns JSON-encoded responses.
This Ajax API makes it possible to add items to the cart, update quantities in the cart, and fetch information about the cart, without a page refresh. With this API, you can also fetch information about a particular product using its handle.
For example, on site: https://weedrepublic.com

Fetching Product Options/Attributes on Product Listing Page

On this page https://stencil.bigcommerce.com/docs/product-resources BigCommerce has mentioned that Product Object has "Options" but in the theme, I am not able to retrieve anything from options property. I am trying to access this in Category Page.
I want to do above because I have to add product attributes on product listing page "templates\components\products\card.html". I need this here because I have to remove quick view option and directly put the product option under product title on this page. Over here I am able to get product's id, name, sku etc but not getting any properties from product options.
I have already asked to BigCommerce Support team and they don't have any solutions and referred me to check here.
The category page calls the common product card model, which does not include the product options property:
https://stencil.bigcommerce.com/docs/common-product-card-model
To get product option data on the category page, you'll need to call the API. One lightweight solution for handling this is to use AWS Lambda with Amazon API Gateway. API Gateway defines an endpoint URL that you can use to trigger a Lambda function that runs a request to the BigCommerce API for product data.
https://docs.aws.amazon.com/lambda/latest/dg/with-on-demand-https.html

How to search products by title using Shopify product search API?

We have created a Shopify app in which user can search for products of his own store by typing first 3 characters of product title. Products will be shown in a dropdown based on his search.
Now the problem is, how we can enable the search system to search directly from product search api?
We checked product search api on shopify but information is limited.
Can anyone help in this please?
Is simple, make your api call thus:
GET /admin/products.json?title=your_product_title

Does ebay API allows to create a listing draft?

I would like to create a listing ebay draft as it is possible to do manually using this flow:
Go to the new listing sell creation page
Choose category id
Put some random data (title, description, etc.)
Close tab
You will see now unfinished draft, when you go to the new listing sell creation page.
Can I do the same thing using eBay api?
The reason of it is that I don't want to implement all functionality of addItem, currently.
eBay API will not allow to create draft listing.
when you call API for creating new listing, API needs all required fields value.
eBay Listing API provide one attribute PrivateListing.it will hide your product for selling.
If PrivateListing is true, designates the listing as private.customer can't see private listing.
eBay Listing API provide one more attribute ScheduleTime.
When you export product in eBay via API you can give ScheduleTime as well, eBay will active product for selling based on ScheduleTime.
You can make product inactive/draft using this alternative way.
http://developer.ebay.com/devzone/xml/docs/Reference/eBay/AddItem.html#AddItem
You can refer above link for eBay API.
As of now, I can confirm eBay does provide the API to create listing draft, though it's in beta at the moment.
POST - /item_draft/
Official doc is here
To my knowledge this cannot be done, since there are some pretty strict constraints around using the addItem API call, and eBay will throw an error if you don't complete the all the required fields. The required fields of addItem are numerous enough that if you could populate these fields, then you are already 90% of the way to completing your listing anyways.
If you are using Selling Manager Pro, you can create product templates which may be a way to accomplish what you are looking for.

BigCommerce JavaScript API

In BigCommerce, can I access the current customer's record using JavaScript?
I want to change something on the product page based on the customer group that the current customer is in.
there is no JS SDK yet for Bigcommerce. However, because the APIs are restful, you should be able to execute a simple GET request to get a customer's record. The only challenge is that you need to get the customer ID/info when they login to the store and then get their record.
There is an example on Bigcommerce forums on using Javascript to hide pricing for customers who are not logged in.
http://forum.bigcommerce.com/f4/global-variable-for-current-user-s-group-1815/index2.html
This combined with GET request on the customer endpoint (http://developer.bigcommerce.com/api/customers) should get you moving in that direction.
Does this help? Are you looking for a code sample?
Use Javascript or jQuery to do the IF statement.
Then use Ajax to request the data that you want to display to the user.
So to answer your question, directly with Javascript you can't, but combine it with some PHP and then you use the API to do what you would like.
Hope this helps :)