php Gravity Perks //电子商务字段//将单独的折扣行项目合并为单个折扣行项目
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Gravity Perks //电子商务字段//将单独的折扣行项目合并为单个折扣行项目相关的知识,希望对你有一定的参考价值。
<?php
/**
* Gravity Perks // eCommerce Fields // Consolidate Separate Discount Line Items into a Single Discounts Line Item
* http://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
*
* Default: https://gwiz.io/2IiPALf
* w/ Snippet: https://gwiz.io/2Itfyfo
*/
// Update "123" to your form ID - or - remove "_123" to apply to all forms.
add_filter( 'gpecf_order_summary_123', function( $summary ) {
if( empty( $summary['discounts'] ) ) {
return $summary;
}
$consolidated_discount = $summary['discounts'][0];
$consolidated_discount['name'] = 'Discounts';
$consolidated_discount['price'] = 0;
foreach( $summary['discounts'] as $discount ) {
$consolidated_discount['price'] += $discount['price'];
}
$summary['discounts'] = array( $consolidated_discount );
return $summary;
} );
以上是关于php Gravity Perks //电子商务字段//将单独的折扣行项目合并为单个折扣行项目的主要内容,如果未能解决你的问题,请参考以下文章
php Gravity Perks // GP电子商务领域//从订单摘要中扣除存款
php Gravity Perks // GP电子商务字段//为订单摘要添加自定义总计
php Gravity Perks //电子商务字段//将单独的折扣行项目合并为单个折扣行项目
php Gravity Perks //填充任何内容//设置后分类术语
php Gravity Perks // GP媒体库// Ajax上传
php Gravity Perks // GP条件定价//显示价格标签