Skip to content

Commit

Permalink
Merge pull request #588 from Shopify/lindadamus/add_multiclass_discounts
Browse files Browse the repository at this point in the history
Add template code for multi-class discounts in rust
  • Loading branch information
jonathanhamel4 authored Jan 27, 2025
2 parents 2ae226e + a258837 commit 77efe7a
Show file tree
Hide file tree
Showing 11 changed files with 5,919 additions and 0 deletions.
2 changes: 2 additions & 0 deletions discounts/rust/discounts/default/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
Cargo.lock
16 changes: 16 additions & 0 deletions discounts/rust/discounts/default/Cargo.toml.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "{{handle | replace: " ", "-" | downcase}}"
version = "1.0.0"
edition = "2021"
rust-version = "1.84"

[dependencies]
serde = { version = "1.0.13", features = ["derive"] }
serde_json = "1.0"
shopify_function = "0.8.1"
graphql_client = "0.14.0"

[profile.release]
lto = true
opt-level = 'z'
strip = true
16 changes: 16 additions & 0 deletions discounts/rust/discounts/default/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Shopify Function development with Rust

## Dependencies

- [Install Rust](https://www.rust-lang.org/tools/install)
- On Windows, Rust requires the [Microsoft C++ Build Tools](https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup). Be sure to select the _Desktop development with C++_ workload when installing them.

## Building the function

You can build this individual function using `cargo build`.

```shell
cargo build --target=wasm32-wasip1 --release
```

The Shopify CLI `build` command will also execute this, based on the configuration in `shopify.extension.toml`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "{{name}}",
"description": "{{name}}"
}
Loading

0 comments on commit 77efe7a

Please sign in to comment.