PAVO 바로 구매 – WooCommerce Points and Rewards 플러그인
WooCommerce Points and Rewards플러그인을 PAVO 바로구매 플러그인과 같이 사용하기 위해서는 아래와 같이 소스 코드 수정이 필요합니다.
파일: wp-content/plugins/woocommerce-points-and-rewards/classes/class-wc-points-rewards-cart-checkout.php
변경 전
[php]
$( ‘form.wc_points_rewards_apply_discount’ ).submit( function() {
var $section = $( ‘div.wc_points_rewards_redeem_points’ );
if ( $section.is( ‘.processing’ ) ) return false;
$section.addClass( ‘processing’ ).block({message: null, overlayCSS: {background: ‘#fff url(‘ + woocommerce_params.ajax_loader_url + ‘) no-repeat center’, backgroundSize: ’16px 16px’, opacity: 0.6}});
var data = {
action: ‘wc_points_rewards_apply_discount’,
discount_amount: $(‘input.wc_points_rewards_apply_discount_amount’).val(),
security: ( woocommerce_params.apply_coupon_nonce ? woocommerce_params.apply_coupon_nonce : wc_checkout_params.apply_coupon_nonce )
};
$.ajax({
type: ‘POST’,
url: woocommerce_params.ajax_url,
data: data,
success: function( code ) {
$( ‘.woocommerce-error, .woocommerce-message’ ).remove();
$section.removeClass( ‘processing’ ).unblock();
if ( code ) {
$section.before( code );
$section.remove();
$( ‘body’ ).trigger( ‘update_checkout’ );
}
},
dataType: ‘html’
});
return false;
});
[/php]
변경 후
[php]
$( ‘form.wc_points_rewards_apply_discount’ ).submit( function() {
var $section = $( ‘div.wc_points_rewards_redeem_points’ );
if ( $section.is( ‘.processing’ ) ) return false;
$section.addClass( ‘processing’ ).block({message: null, overlayCSS: {background: ‘#fff url(‘ + woocommerce_params.ajax_loader_url + ‘) no-repeat center’, backgroundSize: ’16px 16px’, opacity: 0.6}});
var cart_contents = ”;
try {
cart_contents = ‘&serialized_cart_contents=’+fast_checkout_cart.serialized_cart_contents;
} catch(err){
cart_contents = ”;
}
var data = {
action: ‘wc_points_rewards_apply_discount’,
discount_amount: $(‘input.wc_points_rewards_apply_discount_amount’).val()+cart_contents,
security: ( woocommerce_params.apply_coupon_nonce ? woocommerce_params.apply_coupon_nonce : wc_checkout_params.apply_coupon_nonce )
};
$.ajax({
type: ‘POST’,
url: woocommerce_params.ajax_url,
data: data,
success: function( code ) {
$( ‘.woocommerce-error, .woocommerce-message’ ).remove();
$section.removeClass( ‘processing’ ).unblock();
if ( code ) {
$section.before( code );
$section.remove();
$( ‘body’ ).trigger( ‘update_checkout’ );
}
},
dataType: ‘html’
});
return false;
});
[/php]