Я надеялся, что кто-нибудь поможет мне определить, где я иду не так!Я могу заставить страницу показывать форму и иметь всю соответствующую (что мне известно) информацию, но при отправке я получаю внутреннюю ошибку сервера, как будто я пропускаю один шаг!
Я разделилсяэтапы оплаты более 4 страниц по запросу конечного клиента.Способ оплаты ниже.Шлюзы: 1) Шлюз Paypal по умолчанию 2) Официальный шлюз Stripe
Ошибки: ({site} = фактический сайт существует обычно):
2019-02-23T14:04:10+00:00 CRITICAL Uncaught Error: Call to a member function get_id() on boolean in /var/www/vhosts/{site}/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:360
Stack trace:
#0 /var/www/vhosts/{site}/wp-includes/class-wp-hook.php(286): WC_Form_Handler::pay_action(Object(WP))
#1 /var/www/vhosts/{site}/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#2 /var/www/vhosts/{site}/wp-includes/plugin.php(531): WP_Hook->do_action(Array)
#3 /var/www/vhosts/{site}/wp-includes/class-wp.php(750): do_action_ref_array('wp', Array)
#4 /var/www/vhosts/{site}/wp-includes/functions.php(1105): WP->main('')
#5 /var/www/vhosts/{site}/wp-blog-header.php(16): wp()
#6 /var/www/vhosts/{site}/index.php(17): require('/var/www/vhosts...')
#7 {main}
thrown in /var/www/vhosts/{site}/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php on line 360
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?>
<?php
if ( ! is_ajax() ) {
do_action( 'woocommerce_review_order_before_payment' );
}
?>
<?php
$gateways = WC()->payment_gateways->get_available_payment_gateways();
$enabled_gateways = [];
if( $gateways ) {
foreach( $gateways as $gateway ) {
if( $gateway->enabled == 'yes' ) {
$enabled_gateways[] = $gateway;
}
}
}
?>
<div class="payment-methods">
<ul>
<?php
foreach($enabled_gateways as $get_gateway){
echo '<li>Pay with '.$get_gateway->title.'<div class="btn-group"><a href="#payment" class="button" onclick="loadMethod('.str_replace(' ', '_', $get_gateway->title).')">Pay by '.str_replace('Stripe', 'Card', $get_gateway->method_title).'</a></div>';
}
?>
</ul>
</div>
<div class="payment-container" id="payment">
<div class="checkout">
<?php foreach($enabled_gateways as $get_gateway): ?>
<?php #if($get_gateway->title != "PayPal"): ?>
<form name="checkout" method="post" class="checkout1" action="<?php echo esc_url( $get_checkout_url ); ?>" enctype="multipart/form-data">
<?php #wp_nonce_field( 'stripe' ); ?>
<input id="payment_method_<?php echo esc_attr( $get_gateway->id ); ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $get_gateway->id ); ?>" <?php checked( $get_gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $get_gateway->order_button_text ); ?>" />
<input type="hidden" name="woocommerce_pay" value="1" />
<?php $get_gateway->payment_fields(); ?>
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?php do_action( 'woocommerce_pay_order_before_submit' ); ?>
<?php
if($get_gateway->title == "PayPal"){
echo apply_filters( 'woocommerce_pay_order_button_html', '<button type="submit" class="button alt" id="place_order" value="' . esc_attr( $get_gateway->order_button_text ) . '" data-value="' . esc_attr( $get_gateway->order_button_text ) . '">' . esc_html( $get_gateway->order_button_text ) . '</button>' );
}
else{
#echo apply_filters( 'woocommerce_pay_order_button_html', '<button type="submit" class="button alt" id="place_order" value="Pay now" data-value="pay now">pay now</button>' );
echo '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="Place order" data-value="Place order">Place order</button>';
}
?>
<?php wp_nonce_field( 'woocommerce-pay', 'woocommerce-pay-nonce' ); ?>
<?php do_action( 'woocommerce_pay_order_after_submit' ); ?>
</form>
<?php #endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php
if ( ! is_ajax() ) {
do_action( 'woocommerce_review_order_after_payment' );
}
?>