问题描述
我在我的单个产品页面上添加了第二个自定义 Paypal 按钮,以便为我的用户关闭动态付款按钮。
我成功地做到了这一点,按钮工作并且收到了 Paypal 中的付款。
但是,我有一个问题是客户下的订单没有在管理面板仪表板(Shopify)中注册,所以我的物流
也能看到。我的代码
product-template.liquid
就这样
按钮代码
<div class="product-single__add js-product-buttons{% unless product.available %} product-single__add--sold{% endunless %}">
<button type="submit" name="add" class="c-btn c-btn--full c-btn--plus c-btn--{% if section.settings.enable_payment_button %}light{% else %}primary{% endif %} product-single__add-btn js-product-add">
<span class="js-product-add-text">{{ 'products.product.add_to_cart' | t }}</span>
</button>
{% if section.settings.enable_payment_button %}
{{ form | payment_button }}
{% endif %}
</div>
{% endform %}
<!-- Set up a container element for the button -->
<!--<div id="paypal-button-container"></div> -->
</div>
{% endform %}
<!-- Set up a container element for the button -->
<div id="paypal-button-container"></div>
我的 javascript 是这样的
<script>
// Render the PayPal button into #paypal-button-container
paypal.Buttons({
// Set up the transaction
createOrder: function(data,actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: {{product.price | dividedby: 100.0 }}
}
}]
});
},// Finalize the transaction
onApprove: function(data,actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>
由于我是 Shopify 的新手,所以我应该在现有的 javascript 中实现一个事件或函数。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)