This article is written as a practical guide to implementing pagination in a Shopify App. The example code assumes a tech stack of React.js and PHP Laravel, but the concepts discussed can be applied to other tech stacks fairly easily.
Pagination is an essential concept in application development for two main reasons.
Shopify’s Metafield REST API is an excellent resource for App and Theme developers, but it comes with a notable limitation — empty strings cannot be saved! This post explores this problem and presents two approaches that can be used to solve it.
Let’s look at an example. Say that you are building a Shopify App that has an optional “Disclaimer” setting that can be used to display a disclaimer to customers.
Merchants using your App can either fill in the disclaimer’s text input or they can simply leave it empty if they prefer not to show a disclaimer.
I’ve read a lot of articles lately that recommend that developers “stop using
for loops” in favor of more specialized looping techniques like
I agree with this recommendation to some extent.
reduce are great tools and I get a lot of value from using them in my own programs.
But on the other hand, there is nothing wrong with simple
for loops. For loops are just as good as
reduce in many situations. And in some other situations, a plain
for loop can be the best option available.
The following details will be covered:
+ operator that can be used to perform addition. Unlike other programming languages, however, the operator also serves a second purpose: string formatting.
This piece explores how the
+ operator works, and how it can misfire and cause bugs if you aren’t careful. It also shows how these issues can be avoided in the first place.
As mentioned, the
+ operator’s first purpose is to add numbers together. Here’s an example:
const price = 20
const shipping = 3
const tax = 3
Node.js has emerged as the preferred technology stack for Shopify app development. It pairs perfectly with React and Shopify’s Polaris UI library, making it ideal for apps that embed directly into the online stores of Shopify merchants.
This tutorial shows how Node.js Shopify apps can be deployed to a Digital Ocean production server. The server will have the following features:
I had a bit of background in some other programming languages and this was consistent with what I already knew — semicolons are there to help the computer distinguish one instruction from another. Makes sense.
Programming is hard. The ability to translate an idea into code isn’t something that comes naturally to most people, and sometimes we get stuck.
Even after coding for years, you will still hit roadblocks regularly. Computer programming is an incredibly deep field, and it just isn’t possible to master everything about it.
Plus, we all have bad days sometimes.
Software can break in an almost unlimited number of ways, and…
“To a man with a hammer, everything looks like a nail” — Abraham Maslow
I like to think of conditional logic as the bread and butter of software. It gives developers the power to build things that are interesting, useful, and fun.
The most popular way of handling conditional logic is the if statement. The if statement is universal, flexible, and easy to understand, so its popularity comes as no surprise.
There are, however, other ways of handling conditional logic that are often overlooked by developers. …
Set object type was introduced in the 2015 ECMAScript specification and is ready to be used in Node.js and most browsers.
Sets are a lot like Arrays, but a bit different. This article explores these differences and explains when one should be used over another. Let’s take a look.
Sets are a special object type available in ES6. You can create an empty set like this:
const characters = new Set()
Or, you can pass an iterable into the Set’s constructor to populate it. …
Software developer and teacher