shopify

Shopify Sort cart.items array using Liquid script

二次信任 提交于 2019-12-23 01:40:04
问题 I want to sort the cart.items array in the cart.liquid file. And then I can display the times in the table in my expected order. {% for item in cart.items sort_by:item.line_price %} <div class="row"> <div class="span12"> <h1>Your cart</h1> <form action="/cart" method="post" id="cartform"> <table> </table> </form> </div> </div> {% endfor %} But the code doesn't work since I can't use sort_by:item.line_price in for statement. How can I sort an array using built-in features? The other problem is

How to develop rails app for shopify with ScriptTags

非 Y 不嫁゛ 提交于 2019-12-22 12:42:21
问题 I have a shopify app deployed in Heroku, developed in Rails. I need call a javascript function from any shopify store's frontend. I've read this article ( http://www.shopify.com/technology/3033852-shopify-api-update-scripttags-javascript-insertion ), but I don't understand it... Where do I have to put this code: HTTP POST http://their-shop.myshopify.com/admin/scripttags <?xml version="1.0" encoding="UTF-8"?> <script-tag> <src>http://example.com/your-awesome-script.js</src> <event>onload<

Shopify: Remove product from collection via API call

无人久伴 提交于 2019-12-22 10:36:40
问题 I'm trying to use the Shopify API to remove products from a collection. In the docs (https://docs.shopify.com/api/collect) overview it says: DELETE /admin/collects/#{id}.json Remove a Collect from the database While when you jump to the description it says: Remove a product from a collection Destroy the link between a product an a collection DELETE /admin/collects/#{id}.json So can I use this to remove a product form a collection or remove a collection from the DB? And if it's possible to

how can my app modify the shop's template files

亡梦爱人 提交于 2019-12-22 10:31:39
问题 I need to inject liquid markup to the store's theme templates when my app is installed. I know there are ScriptTags, but they load scripts. And I know that the scripts can change the page's DOM. but I need to install my liquid to the product details pages. is it possible? 回答1: I would add your Liquid as a new snippet asset. The merchant can then be instructed to paste a Liquid include statement you provide them in their product Liquid scripts. That is fairly clean. Otherwise, your App could

Date comparison Logic / in Liquid Template Filter

◇◆丶佛笑我妖孽 提交于 2019-12-22 09:42:42
问题 I'm attempting to create a "Pre-Order" Like mechanic where certain elements of my Shopify Liquid Template only show if the current date is more or less than the date specified in a Metafield. As of current this is what I have including logic: <!-- Check Today is correct --> <p>Today: {{'now' | date: '%d-%m-%Y' }}</p> <!-- This is the Metafield Output as a String --> <p>Release Date: {{ product.metafields.Release-Date.preOrder }}</p> <!-- Assign Variable "today_date" to the current date --> {%

Object stored in Rails session becomes a String?

Deadly 提交于 2019-12-22 04:16:16
问题 Normally I wouldn't store objects in a Rails session but I'm using a library that requires this. I've run into a very strange issue where a stored object appears as a String after redirect. To reproduce I've created a sample Rails 4.1 app $ rails new session-test Added a test controller: class HomeController < ApplicationController def index logger.debug "session[:customer]: #{session[:customer]}" logger.debug "session[:customer].name: #{session[:customer].name}" end def from Struct.new

Shopify: How can I handle an uninstall followed by an instant re-install?

我只是一个虾纸丫 提交于 2019-12-21 07:37:57
问题 I've recently had the case that a user un-installed my Shopify app and instantly re-installed it. This caused a problem because I store all my users in a DB table. Login/Installing works as follows: The user tells me his shop URL I forward the user to example.myshopify.com/admin/oauth/authorize where access is granted to my app I check if that shop URL is already stored in my local user DB If not: I request a permanent access token and forward the user to the plan selection page If yes: I get

Shopify order webhooks

巧了我就是萌 提交于 2019-12-20 18:27:13
问题 I looked into the different order webhooks and was wondering when they are triggered. This is what I figured out so far: orders/updated is fired whenever an order is changed in any way, including when an order is created (even before it was authorized and orders/create is fired), closed or cancelled orders/create is fired when the user authorizes the payment orders/paid is fired when the merchant accepts the payment orders/fulfilled is fired when the merchant fulfills the order orders

Unable to receive a permanent access token for my Shopify App

北城以北 提交于 2019-12-20 10:59:02
问题 I'm following the Shopify instructions to get a permanent token for a particular app/shop combination (http://api.shopify.com/authentication.html). I'm able to get the temporary token and then use a simple html form to receive a permanent token: But the response I get is: {"error":"invalid_request"} Can you help me, please? I searched everywhere (Stackoverflow, Shopify support forums, etc...) but cannot find a clue on how to solve this. My app is online and hosted on Heroku. Thanks, 回答1: I

Shopify counts per tags

牧云@^-^@ 提交于 2019-12-20 05:10:21
问题 I am new to shopfiy.I have addded tags like Black, Blue, Green etc. Now i want to show count like Black(12) Blue(1) Green(4) Does anybody help me out Thanks 回答1: My answer to a similar question might help you with this: Shopify Tags total items To get a count of all the products with a given tag you need to loop over the products and manually count them. For example: {% assign collection = collections.all %} {% for tag in collection.all_tags %} {% assign products_count = 0 %} {% for product