如何用数字

时间:2016-06-13 12:12:39

标签: javascript html variables e-commerce shopify

我正在尝试为我的电子商务网站添加一项功能,价格低于8周内支付超过4个简单分期付款(总价/ 4)。

有人可以帮我写这个吗?

目前它说:

 <p class="afterpay-text">Make 4 easy payments of ***** over 8 weeks...</p>

变量为{{ variant.price | money }}

由于

2 个答案:

答案 0 :(得分:2)

假设您使用带有双花括号和滤镜的角度?如果是的话......

  $scope.spreadPayment = function(){
  //+variant.price converts it to a number(leave it out if it is already a number)
//just replace price with your variable
var price = 100;
var quarterOfPrice = price /4;
var weeklyPayments = quarterOfPrice / 2;

return weeklyPayments;

}

<p>Make 4 easy payments of {{spreadPayment() | currency}} over 8 weeks...</p>

答案 1 :(得分:1)

试试这个:

{{ variant.price | divided_by: 4 | money }}