shopify 注意点,持续更新

172 阅读1分钟

shopify cli 的 --store 为 店铺id.myshopify.com

如果--store的填写格式有误的话,会导致报 error invalid_target

ruby 版本过低,不能满足shopify的需求,使用rbenv 管理 ruby 版本

git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby- 
build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> 
~/.bashrc
exec $SHELL

rbenv install 3.0.2
rbenv global 3.0.2
ruby -v

结算必须用form 表单 且 触发的按钮 name 必须等于 checkout

<form action="{{ routes.cart_url }}" method="POST">
        <button
          type="submit"
          name="checkout"
        >
          CHECKOUT
        </button>
</form>

/cart/add.js Api 的 ID 值是 product.variants 里的 ID值

产品页立即购买(buy it now)跳转到下单页

<a class="checkout" :href="`/cart/${product?.variants?.[0].id}:1/`">Buy it now</a>