Hello all,
I was wondering if anyone knew how or had experience with adding a custom value to a product/cart object?
Thanks,
P.
Hello all,
I was wondering if anyone knew how or had experience with adding a custom value to a product/cart object?
Thanks,
P.
Hi,
I'm practicing shopify app development by simply creating an embedded app with Ruby on Rails that adds a link to a product detail page. When the link is clicked, the user is redirected to twitter. I'm fairly confident that the problem doesn't lay in the code, but in the authentication of my app or perhaps the environment setup. I am seeing errors in the console such as:
-Content Security Policy: The page's settings observed the loading of a resource at http://localhost:3000/?hmac=...). A CSP report is being sent.
-Loading mixed (insecure) active content "http://localhost:3000/?hmac=..." on a secure page
-Load denied by X-Frame-Options: http://twitter.com does not permit cross-origin framing.
Any help would be greatly appreciated.
Hi Peiying,
Take a look at https://help.shopify.com/themes/customization/products/get-customization-information-for-products
Gavin.
Code examples for Python which I have found in forums, provided to assist anyone trying to get started in Python. Please add to these examples to assist others.
I have still not worked out how to get details of orders as requested in the inital post, any assitance would be appreciated.
Cheers
Phil
++++++++++++++++++++++++++++++
Code Examples, try them one at a time on your Shopify "shop"
import shopify
shop_url = "https://0abcdfghba92d67f64caa74e64:5fd0eabcdefg07c9f326cdfc90b2353e@MYSHOP.myshopify.com/admin" (modified, use your details).
shopify.ShopifyResource.set_site(shop_url)
shop = shopify.Shop.current()
#How many products & list them
product = shopify.Product()
success = product.count()
print success
success = product.find()
print success
#How many orders & list them
order = shopify.Order()
success = order.count()
print success
success = order.find()
print success
#get basic order details - (ord = your order id)
order = shopify.Order.find(ord)
em = order.email
di = order.id
nam = order.name
ful = order.fulfillment_status
cur = order.currency
cr = order.created_at
n = order.note
print 'email' ,em, '\n','Order_id ',di, 'Order_Name ', nam, '\n','Fulfillment ', ful, 'Currency ',cur, '\n','Created At ', cr, 'Notes ',n,
#get products by params, other parameters do not seem to work
newProducts = shopify.Product.find(created_at_min="2016-07-28 00:00")
print newProducts
#get shop keys - not sure what this is giving, but it works
shop = shopify.Shop.current()
print shop.attributes.keys()
print shop.name
#View product price- (prd = your productid)
product = shopify.Product.find(prd)
price = product.variants[1].price
print price
#Update a product price
product = shopify.Product.find(prd) - (prd = your productid)
product.variants[1].price = new_price #index number determine which product
product.save()
#Fulfillment test, works but need to understand how to "unfulfill, fulfill a particular item etc
{"fulfillment":{"tracking_numbers":null,"line_items":[{"id":4998669379}]}}
#get orders by params - Params not working properly - created_at_min works, others don't.
newOrders = shopify.Order.find(status="open", fulfillment_status="fulfilled", created_at_min="2016-07-27 00:00")
print newOrders
# Create a new product
new_product = shopify.Product()
new_product.title = "Red1231 SWTrnr"
new_product.product_type = "SWT"
new_product.vendor = "Trish1"
success = new_product.save() #returns false if the record is invalid
#Find and update a product - (prd = your productid)
product = shopify.Product.find(prd)
product.title = "Red32211"
product.save()
Anyone have the same questions and found an answer ?
With v2 of the sdk, caching was introduced, it is documented here. However i can't find a simple usage tutorial, for example, i wish to use the modelmanager to save a cart between app restarts, and the doc just tell us we can do it, but not the right approach.
The Buy SDK does not provide access to Shopify carts, only local device carts. To achieve what you want, you would have to write your own back-end service using the Embedded Apps SDK. Such an app can talk directly to Shopify through the admin API, which is not available to clients. But your client could talk to your service.
Thanks, this was clear
Sorry, the SDK does not include built-in caching support. It includes hooks so you can extend it with your own caching solution. The hooks are used in the BUYClient to ensure that your custom model manager gets notified when new objects (or updated versions of objects) are received from Shopify.
The problem, of course, is the word "support". The SDK supports caching by providing extension points, but does not implement caching.
This is spelled out in the document that you linked to.
Search via the SDK is a feature request. If you don't mind, can you add an issue on github for the feature request? Thanks.
How are you initializing the BUYClient?
Did you enable the mobile channel on your shop and configure the client with the correct shop domain name, api key, and channel id?
The mobile channel is not enabled on shop delvrs.myshopify.com, but you may be using a different shop. If you are using with a brand new shop, then you must use version 2 of the SDK. 1.2.x is not supported for new shops created in the last week.
As far as saving a cart locally, you probably don't need to worry about using the model manager caching. You should be able to use the JSON transformation support to create a data blob that you can save locally to user defaults or your preferred location, and then restore when the app relaunches.
Hi,
We are getting forbbinden request whenever i am calling get collection in android shopify mobile sdk which released recently
buyClient.getCollections(1, new Callback<List<Collection>>() { @Override public void success(List<Collection> collections) { Toast.makeText(myContext,collections.size()+"",Toast.LENGTH_SHORT).show() } @Override public void failure(BuyClientError error) { Toast.makeText(myContext,error.getMessage()+"",Toast.LENGTH_SHORT).show(); } });
Whenever we call this failure gets called and response is -
Response{protocol=http/1.1, code=403, message=Forbidden, url=https://shopurl/api/apps/8/collection_listings.json?page=1&limit=25}
https://developers.google.com/speed/pagespeed/insights/?url=vivomasks.com&tab=mobile
Some of these issues seem like Shopify issues rather than my specific store. After looking at page speed insights for a few Shopify stores, I haven't seen any with perfect scores. Any idea on how to fix, or is it impossible?
It is possible to increase the score but I had not seen 100. And this is because there are some assets injected by Shopify and 3rd party APPs that you do not have access to.
The overall score is not really the goal but having a low initial render time.
Thanks! Can you recommend a good tool to calculate initial render time?
I usually use https://www.webpagetest.org.
You can set up various performance test that are performed on selected 3rd party servers.
Here is a load test: https://www.webpagetest.org/video/compare.php?tests=160809_D2_RPB-r:1-c:0
The test is performed on California USA - EC2 - Chrome - 3GFast
On the waterfall you will see what is loaded and the time that takes.
Hey Nejc,
This issue has been resolved as of today. You should now be able to successfully add an application ID containing a dash. Thanks for bringing this to our attention!
Hi there,
The HTTP response is generally a good indicator of what's going wrong -- in this case, you should specify smart_collection instead of smart-collection.
When sending requests to a shop via a public API client, you don't need to specify the API key and secret key. You only need to provide the X-Shopify-Access-Token header value. If you're still experiencing a 404 error, make sure you're typing the name of the shop correclty (where you currently have myshop.myshopify.com).