shopify

Importing Node Modules With JavaScript

蹲街弑〆低调 提交于 2019-12-01 21:27:22
I apologize for the simple question, but I'm pretty new to web development and JavaScript. I want to import a package I've installed using npm, specifically shopify-buy following the guide here: https://shopify.github.io/js-buy-sdk/ The package is in my node_modules folder and I'm trying to import it into a JavaScript document using import Client from 'shopify-buy'; When I try to load everything up in Chrome, I get an error on the import line Uncaught SyntaxError: Unexpected identifier The Firefox error is a bit different: import declarations may only appear at top level What am I doing wrong?

Howto check if current visitor is shop's admin?

一世执手 提交于 2019-12-01 17:58:41
I would like to create a product that would be available in Shopify's storefront but would only be accessible for the shop administrator. Is there anyway to identify if the current user is an admin via liquid? or is there any other solution for this challenge. Thanks! If you're signed in as an admin, when rendering the {{ content_for_header }} include, it will contain some JavaScript to push the page content down to make room for the Shopify admin bar. We can utilize capture to store the {{ content_for_header }} code as a liquid variable and then use the contains operator to check if admin_bar

shopify app proxy: send customer data or only customer ID

主宰稳场 提交于 2019-12-01 12:19:15
问题 I need to get customer first and last names and email address for the server side logic. As I see it there are 2 options: Form submit with the data in the body of the request to the proxied URL GET request to the proxied URL with the customer ID in the URL, then using the shopify API to get all customer's info I tend to use option #1 as it saves a call to Shopify, I will send the data over https. How would you suggest doing so? 回答1: If you are submitting to a proxy form you should check out

Shopify Tags total items

与世无争的帅哥 提交于 2019-12-01 10:49:00
In Shopify, how do I show a list of tags followed by the number of products with that tag? Example: Black(12), Blue(10). Currently the code looks like this, but it doesn't work. <ul> {% for tag in collection.all_tags %} <li> <a href="https://mystore.myshopify.com/collections/all/{{ tag }}"> {{ tag }} </a> ({{ tag.products_count }}) </li> {% endfor %} </ul> products_count is an attribute of collection , not tag . I believe you would need to manually loop through the products and count the number with the specified tag. For example: {% assign collection = collections.all %} <ul> {% for tag in

Shopify liquid: How can I conditionally include snippets in Shopify liquid?

浪尽此生 提交于 2019-12-01 03:38:46
I would like to include a snippet in a template but only if the snippet file exist. Is there any way I can do it? Now I'm just using: {% include 'snippetName' %} But this throws the error: Liquid error: Could not find asset snippets/snippetName.liquid The reason I need such a functionality is because I have a background process that adds the snippet later on. Had this problem myself. This was my solution: {% capture the_snippet_content %}{% include the_snippet %}{% endcapture %} {% unless the_snippet_content contains "Liquid error" %} {% include reviews_snippet %} {% endunless %} Basically

How to get consumer group offsets for partition in Golang Kafka 10

怎甘沉沦 提交于 2019-12-01 01:27:12
Now that Golang Kafka library (sarama) is providing consumer group capability without any external library help with kafka 10. How can I get the current message offset being processed by a consumer group at any given time ? Previously I used kazoo-go ( https://github.com/wvanbergen/kazoo-go ) to get my consumer group message offset as it is stored in Zookeeper. Now I use sarama-cluster ( https://github.com/bsm/sarama-cluster ), I am not sure which API to use to get my consumer group message offset. I am also working with Sarama and Kafka to get offset of a topic. You can get offset with

Shopify liquid: How can I conditionally include snippets in Shopify liquid?

戏子无情 提交于 2019-11-30 23:56:07
问题 I would like to include a snippet in a template but only if the snippet file exist. Is there any way I can do it? Now I'm just using: {% include 'snippetName' %} But this throws the error: Liquid error: Could not find asset snippets/snippetName.liquid The reason I need such a functionality is because I have a background process that adds the snippet later on. 回答1: Had this problem myself. This was my solution: {% capture the_snippet_content %}{% include the_snippet %}{% endcapture %} {%

SSL_connect error when accessing Shopify API with rubygem

喜夏-厌秋 提交于 2019-11-30 21:37:03
I'm having trouble accessing the Shopify API using the shopify_api gem. Here's what happens: >> require "shopify_api" #=> false >> ShopifyAPI::Base.site = "https://username:secret@mysite.myshopify.com/admin" => "https://username:secret@mysite.myshopify.com/admin" >> products = ShopifyAPI::Product.find(:all) Errno::ECONNRESET: Connection reset by peer - SSL_connect from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from /Users/zubin/.rvm/rubies/ruby-1.9.3

JS Cookie hide/show div

徘徊边缘 提交于 2019-11-30 19:58:13
问题 Trying to make a jQuery cookie hide/show box using JS Cookie, but I somehow can't make it work. The box won't display at all. I'm using Shopify. #pop-up { display: none; } Jquery: <script type='text/javascript'>//<![CDATA[ $(window).load(function(){ // if no cookie if (!$.cookie('alert')) { $( "#pop-up" ).show(); $("#hide").click(function() { $( "#pop-up" ).slideUp( "slow" ); // set the cookie for 24 hours var date = new Date(); date.setTime(date.getTime() + 24 * 60 * 60 * 1000); $.cookie(

How to get consumer group offsets for partition in Golang Kafka 10

喜夏-厌秋 提交于 2019-11-30 19:02:43
问题 Now that Golang Kafka library (sarama) is providing consumer group capability without any external library help with kafka 10. How can I get the current message offset being processed by a consumer group at any given time ? Previously I used kazoo-go (https://github.com/wvanbergen/kazoo-go) to get my consumer group message offset as it is stored in Zookeeper. Now I use sarama-cluster (https://github.com/bsm/sarama-cluster), I am not sure which API to use to get my consumer group message